Articles
-
2023-06-20 ◦ loops - How to for_each through a list(objects) in Terraform 0.12 - Stack Overflow
Using for_each on a list of strings Using for_each on a list of objects Using for_each to combine two lists Using for_each in a nested block Using for_each as a conditional
-
2023-06-13 ◦ Terraform Files - How to Structure Terraform Project
-
2023-06-13 ◦ 4 Tips to better structure Terraform projects Which files:
provider.tf
: contains the terraform block and provider blockdata.tf
: contains all data sourcesvariables.tf:
contains all defined variableslocals.tf
: contains all local variablesoutput.tf
: contains all output resources
Locals vs variables:
- variable blocks: should be used for values that are not known beforehand, such IDs that are defined at runtime.
- Local blocks: should be used for values that are known beforehand, but are good to abstract as variables, such as constants
Use
yamldecode
to load a YAML file with all the settings (instead of defining everything in the TF file)
AWS
- 2023-08-16 ◦ The AWS IA Team’s best practices for Terraform
- 2023-08-02 ◦ Create an AWS CloudWatch Metric Filter and Alarm in Terraform
Layout
- 2023-09-19 ◦ Best practices for using Terraform (Google Cloud)
- 2023-08-01 ◦ How to Create Terraform Multiple Environments
- separated directors vs workspaces
- 2023-08-01 ◦ How to Manage Terraform State in AWS - DEV Community
- Mentions workspaces
- Has a good project layout (where each deployment environment gets its own folder)
Tagging
- 2023-08-01 ◦ Best Practices for Terraform AWS Tags
Security
- 2023-09-15 ◦ Terraform - How do you handle secrets? (r/devops)