Terraform interview question · Most asked
What are the most common Terraform mistakes you have seen in teams?
Summary
Local state or state in Git; no locking; one giant state for everything; using count for collections; unpinned providers; secrets in variables files committed to Git; manual console changes causing drift; applying from laptops; huge copy-pasted configurations instead of modules (or over-engineered modules); and not reading plans before applying.
Longer Answer
Each has a clear fix: remote, locked, versioned state; smaller stacks; for_each; pinned versions and lock files; secret managers and sensitive values; restricted console access with drift detection; CI-based applies with reviewed plans; sensible module boundaries; and a culture of reviewing every plan, especially for destroys and replacements.
Key Points
- State handling mistakes.
- count, unpinned versions, secrets in Git.
- Drift and laptop applies.
- Not reading plans.
Explanation
What interviewers look for
Experience-based answers with fixes, not just a list.
More most-asked Terraform questions
- How do you handle secrets in Terraform?
- How would you run Terraform in CI/CD?
- What is Terraform state, why is it needed, and where should it be stored?
- count or for_each: when do you use each?
- Walk through terraform init, plan and apply. What does each do?
- What is Terraform, and how does it work at a high level?
- What are Terraform modules, and how do you design good ones?
- A terraform plan wants to destroy and recreate a database. What do you do?