Terraform scenario interview questions
Terraform questions in senior interviews are about risk, not syntax. Can you read a plan and spot a replacement, explain what state is for, and keep one bad apply from taking out everything else?
Each question below is the exact prompt from a DevOps Ledger challenge. Decide what you would do, then open the challenge to defend it.
5 scenarios: 1 beginner, 2 intermediate, 2 advanced. Answer keys reviewed by Branko Petric.
What interviewers probe
- Reading a plan for destroy and forces-replacement lines
- Where state lives, who can lock it, and what drift means
- Importing existing resources instead of recreating them
- Splitting state to limit the blast radius of one apply
The questions
- 01advanced14 min
Terraform Wants to Replace the Database. Apply Now?
Your terraform plan for a small tag change shows it will destroy and recreate the production RDS instance (force replacement). It is mid-afternoon, peak traffic. Do you apply now, and if not, what do you do instead?
Practice this scenario - 02intermediate12 min
Someone Changed Infra by Hand. Terraform Plan Is a Mess.
An engineer made a change in the cloud console by hand, and now terraform plan shows a confusing diff that wants to revert their change. State and reality are out of sync. How do you reconcile this safely?
Practice this scenario - 03advanced15 min
One Giant Terraform State Runs Everything
All of your infrastructure lives in one giant Terraform state. plan takes 10 minutes, every apply touches production-critical resources, and people are scared to run it. A teammate says just keep applying carefully. How do you fix this safely?
Practice this scenario - 04intermediate12 min
Terraform Doesn't Know the Hand-Made DB. Let It Build a New One?
You're bringing a manually-created prod RDS instance under Terraform, and because it's not in state, plan shows Terraform wanting to create a new instance. A teammate says just apply it, Terraform will make a matching one, we'll point the app at it and be consistent. What do you do, and why?
Practice this scenario - 05beginner10 min
Commit terraform.tfstate to the Repo So Everyone Shares It?
Two engineers ran terraform apply from their laptops and got conflicting results. A teammate proposes committing terraform.tfstate to the git repo so everyone shares the same state. Do you agree, and what do you do instead?
Practice this scenario
Worked answers
- Terraform Scenario Based Interview Questions: Read the Plan, Then Answer
Terraform scenario based interview questions, worked: a destroy in the plan, state drift, import vs recreate, state in git and blast radius, with real commands.
Free Terraform guides
Practice defending your decisions
DevOps Ledger is a scenario-based DevOps and SRE interview practice platform: you pick a real production incident, defend your decision in a chat against a senior-engineer AI that pushes back, and get scored against an answer key written before you started.
A general chatbot makes up an answer on the spot. DevOps Ledger grades you against an answer key written before you started.
One payment. 12 months of access. No subscription, nothing renews.
Get full access - $19