github.com/hugorut/terraform@v1.1.3/website/docs/language/configuration-0-11/terraform.mdx (about)

     1  ---
     2  page_title: Terraform Settings - 0.11 Configuration Language
     3  description: >-
     4    The `terraform` configuration section is used to configure Terraform itself,
     5    such as requiring a minimum Terraform version to execute a configuration.
     6  ---
     7  
     8  # Terraform Settings
     9  
    10  -> **Note:** This page is about Terraform 0.11 and earlier. For Terraform 0.12
    11  and later, see
    12  [Configuration Language: Terraform Settings](/language/settings).
    13  
    14  The `terraform` configuration section is used to configure Terraform itself,
    15  such as requiring a minimum Terraform version to execute a configuration.
    16  
    17  This page assumes you're familiar with the
    18  [configuration syntax](/language/configuration-0-11/syntax)
    19  already.
    20  
    21  ## Example
    22  
    23  Terraform configuration looks like the following:
    24  
    25  ```hcl
    26  terraform {
    27    required_version = "> 0.7.0"
    28  }
    29  ```
    30  
    31  ## Description
    32  
    33  The `terraform` block configures the behavior of Terraform itself.
    34  
    35  The currently only allowed configurations within this block are
    36  `required_version` and `backend`.
    37  
    38  `required_version` specifies a set of version constraints
    39  that must be met to perform operations on this configuration. If the
    40  running Terraform version doesn't meet these constraints, an error
    41  is shown. See the section below dedicated to this option.
    42  
    43  See [backends](/language/settings/backends/configuration) for more detail on the `backend`
    44  configuration.
    45  
    46  **No value within the `terraform` block can use interpolations.** The
    47  `terraform` block is loaded very early in the execution of Terraform
    48  and interpolations are not yet available.
    49  
    50  ## Specifying a Required Terraform Version
    51  
    52  The `required_version` setting can be used to require a specific version
    53  of Terraform. If the running version of Terraform doesn't match the
    54  constraints specified, Terraform will show an error and exit.
    55  
    56  When [modules](/language/configuration-0-11/modules) are used, all Terraform
    57  version requirements specified by the complete module tree must be
    58  satisfied. This means that the `required_version` setting can be used
    59  by a module to require that all consumers of a module also use a specific
    60  version.
    61  
    62  The value of this configuration is a comma-separated list of constraints.
    63  A constraint is an operator followed by a version, such as `> 0.7.0`.
    64  Constraints support the following operations:
    65  
    66  - `=` (or no operator): exact version equality
    67  
    68  - `!=`: version not equal
    69  
    70  - `>`, `>=`, `<`, `<=`: version comparison, where "greater than" is a larger
    71    version number
    72  
    73  - `~>`: pessimistic constraint operator. Example: for `~> 0.9`, this means
    74    `>= 0.9, < 1.0`. Example: for `~> 0.8.4`, this means `>= 0.8.4, < 0.9`
    75  
    76  For modules, a minimum version is recommended, such as `> 0.8.0`. This
    77  minimum version ensures that a module operates as expected, but gives
    78  the consumer flexibility to use newer versions.
    79  
    80  ## Syntax
    81  
    82  The full syntax is:
    83  
    84  ```text
    85  terraform {
    86    required_version = VALUE
    87  }
    88  ```