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

     1  ---
     2  layout: "docs"
     3  page_title: "Override Files - 0.11 Configuration Language"
     4  sidebar_current: "docs-conf-old-override"
     5  description: |-
     6    Terraform loads all configuration files within a directory and appends them together. Terraform also has a concept of overrides, a way to create files that are loaded last and merged into your configuration, rather than appended.
     7  ---
     8  
     9  # Override Files
    10  
    11  -> **Note:** This page is about Terraform 0.11 and earlier. For Terraform 0.12
    12  and later, see
    13  [Configuration Language: Override Files](../configuration/override.html).
    14  
    15  Terraform loads all configuration files within a directory and
    16  appends them together. Terraform also has a concept of _overrides_,
    17  a way to create files that are loaded last and _merged_ into your
    18  configuration, rather than appended.
    19  
    20  Overrides have a few use cases:
    21  
    22    * Machines (tools) can create overrides to modify Terraform
    23      behavior without having to edit the Terraform configuration
    24      tailored to human readability.
    25  
    26    * Temporary modifications can be made to Terraform configurations
    27      without having to modify the configuration itself.
    28  
    29  Overrides names must be `override` or end in `_override`, excluding
    30  the extension. Examples of valid override files are `override.tf`,
    31  `override.tf.json`, `temp_override.tf`.
    32  
    33  Override files are loaded last in alphabetical order.
    34  
    35  Override files can be in Terraform syntax or JSON, just like non-override
    36  Terraform configurations.
    37  
    38  ## Example
    39  
    40  If you have a Terraform configuration `example.tf` with the contents:
    41  
    42  ```hcl
    43  resource "aws_instance" "web" {
    44    ami = "ami-408c7f28"
    45  }
    46  ```
    47  
    48  And you created a file `override.tf` with the contents:
    49  
    50  ```hcl
    51  resource "aws_instance" "web" {
    52    ami = "foo"
    53  }
    54  ```
    55  
    56  Then the AMI for the one resource will be replaced with "foo". Note
    57  that the override syntax can be Terraform syntax or JSON. You can
    58  mix and match syntaxes without issue.