2019-01-17 00:35:53 +01:00
|
|
|
---
|
2021-12-15 03:41:17 +01:00
|
|
|
page_title: Load Order and Semantics - 0.11 Configuration Language
|
|
|
|
description: >-
|
|
|
|
When invoking any command that loads the Terraform configuration, Terraform
|
|
|
|
loads all configuration files within the directory specified in alphabetical
|
|
|
|
order.
|
2019-01-17 00:35:53 +01:00
|
|
|
---
|
|
|
|
|
|
|
|
# Load Order and Semantics
|
|
|
|
|
2019-01-17 01:06:49 +01:00
|
|
|
-> **Note:** This page is about Terraform 0.11 and earlier. For Terraform 0.12
|
|
|
|
and later, see
|
2021-12-15 03:41:17 +01:00
|
|
|
[Configuration Language](/language).
|
2019-01-17 01:06:49 +01:00
|
|
|
|
2019-01-17 00:35:53 +01:00
|
|
|
When invoking any command that loads the Terraform configuration,
|
|
|
|
Terraform loads all configuration files within the directory
|
|
|
|
specified in alphabetical order.
|
|
|
|
|
|
|
|
The files loaded must end in
|
|
|
|
either `.tf` or `.tf.json` to specify the format that is in use.
|
|
|
|
Otherwise, the files are ignored. Multiple file formats can
|
|
|
|
be present in the same directory; it is okay to have one Terraform
|
|
|
|
configuration file be Terraform syntax and another be JSON.
|
|
|
|
|
2021-12-15 03:41:17 +01:00
|
|
|
[Override](/language/configuration-0-11/override)
|
2019-01-17 00:35:53 +01:00
|
|
|
files are the exception, as they're loaded after all non-override
|
|
|
|
files, in alphabetical order.
|
|
|
|
|
|
|
|
The configuration within the loaded files are appended to each
|
|
|
|
other. This is in contrast to being merged. This means that two
|
|
|
|
resources with the same name are not merged, and will instead
|
|
|
|
cause a validation error. This is in contrast to
|
2021-12-15 03:41:17 +01:00
|
|
|
[overrides](/language/configuration-0-11/override),
|
2019-01-17 00:35:53 +01:00
|
|
|
which do merge.
|
|
|
|
|
|
|
|
The order of variables, resources, etc. defined within the
|
|
|
|
configuration doesn't matter. Terraform configurations are
|
|
|
|
[declarative](https://en.wikipedia.org/wiki/Declarative_programming),
|
|
|
|
so references to other resources and variables do not depend
|
|
|
|
on the order they're defined.
|