The three core Terraform commands — `plan`, `apply`, and `destroy` — are more powerful and nuanced than their basic usage suggests. `terraform plan` has targeting flags, output formats, and refresh behaviours that change what it computes. `terraform apply` has safety mechanisms, partial apply scenarios, and retry behaviours that affect production reliability. `terraform destroy` has safeguards and ordering guarantees that make it safer than running it naked. Understanding these commands at a production depth — including what happens when they fail partway through, how to run partial applies for large configurations, and how to use plan output files to ensure exactly what was reviewed is what gets applied — separates engineers who run Terraform from engineers who operate Terraform safely in production.
30 minintermediate
Plan, Apply and Destroy in Depth
Analogy🏏Cricket
🏏 Think of it like cricket: Before standardised cricket rulebooks existed, every ground played by its own local customs — different LBW interpretations, different wide-ball rules, inconsistent DRS protocols. A touring team playing in a new city had to learn an entirely different set of rules. The standardised ICC rulebook is IaC: a version-controlled document that specifies exactly how cricket is played anywhere in the world. When any ground host asks 'how should this match be set up?', they apply the rulebook — not their memory, not local tradition, not a wiki page from 2019. Every ground becomes reproducible because they're all applying the same version-controlled specification. The insight is that codifying rules enables consistency at scale — you can run a thousand simultaneous cricket matches and every one follows the same rules because they all reference the same canonical document.
Lesson 7 of 24
0% complete