Terraform Cheat Sheet¶
Scannable commands and patterns for the Terraform track. Prefer the full tutorials when you need why, not only how.
Quick reference¶
| Area | Commands / notes |
|---|---|
| Loop | fmt → init → validate → plan -out → apply |
| Init | terraform init -input=false; -upgrade when intentional |
| Plan | terraform plan -input=false -out=tfplan |
| Apply | terraform apply -input=false tfplan |
| State | terraform state list; show ADDR; never commit *.tfstate* |
| Output | terraform output; sensitive outputs redacted in CLI |
| Fmt/CI | terraform fmt -check; TF_IN_AUTOMATION=1 |
| Modules | source + version pin; path.module |
| Meta | for_each over count; lifecycle sparingly |
| Destroy | terraform destroy only for labs / approved teardown |
Common mistakes¶
- Copy-pasting without reading expected output
- Skipping cleanup (leftover containers, state, or temp files)
- Mixing production credentials into lab shells
Related¶
- Track: Terraform
- Start: Terraform introduction
- Interview bank: Terraform interview prep
- Learning path: DevOps Engineer