github.com/bengesoff/terraform@v0.3.1-0.20141018223233-b25a53629922/website/source/docs/configuration/override.html.md (about)

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