github.com/rstandt/terraform@v0.12.32-0.20230710220336-b1063613405c/website/docs/configuration-0-11/terraform.html.md (about)

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