github.com/jpreese/tflint@v0.19.2-0.20200908152133-b01686250fb6/docs/rules/terraform_required_version.md (about)

     1  # terraform_required_version
     2  
     3  Disallow `terraform` declarations without require_version.
     4  
     5  ## Configuration
     6  
     7  ```hcl
     8  rule "terraform_required_version" {
     9    enabled = true
    10  }
    11  ```
    12  
    13  ## Example
    14  
    15  ```hcl
    16  terraform {
    17    required_providers {
    18      aws = ">= 2.7.0"
    19    }
    20  }
    21  ```
    22  
    23  ```
    24  $ tflint
    25  1 issue(s) found:
    26  
    27  Warning: terraform "required_version" attribute is required
    28  
    29  Reference: https://github.com/terraform-linters/tflint/blob/v0.11.0/docs/rules/terraform_required_version.md 
    30  ```
    31  
    32  ## Why
    33  The `required_version` setting can be used to constrain which versions of the Terraform CLI can be used with your configuration. 
    34  If the running version of Terraform doesn't match the constraints specified, Terraform will produce an error and exit without 
    35  taking any further actions.
    36  
    37  ## How To Fix
    38  
    39  Add the `required_version` attribute to the terraform configuration block.