github.com/loicalbertin/terraform@v0.6.15-0.20170626182346-8e2583055467/website/docs/configuration/override.html.md (about)

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