config/terraform folder is for common configurations. All files in the folder get built and included with the deployed module. Common examples:
- Backend Config: configure which backend to use by default. IE: S3
- Provider Config: configure which provider to use by default. IE: AWS
- Terraform Tfvars: Tfvars you want always set.
- Locals: Locals you want always available.
Files that end with
.rb get processed with different strategies as part of being built.
|.tf||Will be processed with ERB. This allows add a little extra power to the Terraform HCL language with templating logic.|
|.rb||Will be processed by the Terraspace Ruby DSL. This allows you to write Terraform code with Ruby.|
config/terraform is for common configurations. They’re overridable within each module itself, though. For example:
- config/terraform/backend.tf - common configuration
- app/stacks/demo1 - does not have a backend.tf
- app/stacks/demo2/backend.tf - overrides backend.tf
When Terraspace builds the stacks,
app/stacks/demo2/backend.tf. Files within the stack have higher precedence than the
Note, since terraspace provides a little extra power with ERB templating, you can also have dynamic ERB logic in the
config/terraform files. It’s up to you, Terraspace gives you options.
The next docs cover different ways to leverage config.