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
- 2024-03-05 ◦ How to Deploy AWS Config Conformance Packs Using Terraform | AWS Cloud Operations & Migrations Blog
- Deploy AWS Config conformance packs using Terraform
- 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
Best Practices
- 2024-04-18 ◦ (Almost) Every infrastructure decision I endorse or regret after 4 years running infrastructure at a startup · Jack’s home on the web
- 2023-11-14 ◦ What Terraform best practice isn’t talked about enough?
Layout
- 2023-10-16 ◦ Community | Automating Multiple Environments with Terraform
- 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)
Mono-repo vs multi-repo
- 2023-12-06 ◦ Monorepo vs. multi-repo: Different strategies for organizing repositories | Thoughtworks
- 2023-12-06 ◦ Terraform Mono Repo vs. Multi Repo: The Great Debate
Tagging
- 2023-08-01 ◦ Best Practices for Terraform AWS Tags
Testing
Security
- 2023-09-15 ◦ Terraform - How do you handle secrets? (r/devops)