What does each of `terraform validate`, `plan` and `terraform test` actually check?
BeginnerScenarioTesting Upgrades and Large-Scale Operations
Answer
Situation read → A team thinks validate means the config works.
What I'd do →
validate: syntax, types and references only; no cloud calls, no provider credentials.plan: computes the real diff against state and the cloud; catches invalid values the API rejects at plan time.terraform test: runs.tftest.hclfiles with assertions against plan or apply results.
Why → They're layers: structure, behaviour against reality, and behaviour you assert.
Interview tip → Many API errors only appear on apply (quotas, IAM), so plan isn't proof.
More on Testing Upgrades and Large-Scale Operations
Write a native test for a module that creates an encrypted S3 bucket.IntermediateCompare Terratest with `terraform test`.IntermediateReal-cloud integration tests leave orphaned resources when they fail midway. How do you handle that?AdvancedHow do you upgrade from Terraform 1.5 to 1.9 safely?IntermediateMajor AWS provider upgrade from v4 to v5 (or v5 to v6) across many stacks. How do you plan it?AdvancedA stack is still on Terraform 0.12 syntax and old providers. What upgrade path do you follow?Advanced