Career preparation
DevOps interview preparation: Terraform scenario practice
A strong infrastructure interview answer does more than name a Terraform command. It identifies the risk, explains how to collect evidence, proposes a controlled response and describes how to verify the outcome.
A repeatable answer structure
Use four parts: context, evidence, decision and verification. State what you know, identify what remains uncertain, choose a proportionate action, and explain what a successful result looks like. These original exercises are independent practice, not verified questions from particular employers.
Five practice scenarios
1. Unexpected drift
A managed security group was changed outside Terraform. How would you investigate before proposing a change?
Review an answer outline
Compare the declared configuration with a normal plan and available change history. A refresh-only plan can help inspect proposed state updates caused by external changes, but it does not itself repair the remote resource. Establish who made the change and whether it should be retained. Choose a reviewed reconciliation strategy and verify the resulting plan.
2. Concurrent deployment jobs
A second pipeline cannot acquire the state lock while the first is running. What do you do?
Review an answer outline
Identify the owning run and confirm that both jobs target the same state. Let the legitimate run finish, coordinate retries, and improve pipeline concurrency controls. Never assume a lock is abandoned merely because it blocks another job.
3. Shared module upgrade
A module version upgrade proposes replacing a resource that should remain available. How do you respond?
Review an answer outline
Stop the proposed deployment, inspect the plan and module changes, and determine which address or argument triggered replacement. Review compatibility and migration options in an isolated environment, then have the proposed resolution reviewed before changing production.
4. Credentials and state
A team proposes storing cloud credentials in a Terraform configuration so that pipelines are easier to reproduce. What alternative would you recommend?
Review an answer outline
Use approved short-lived workload identities or another organization-approved credential mechanism. Keep secrets outside source control, review state and plan handling for sensitive values, and scope access to the minimum required permissions. A sensitive output label does not automatically make underlying state data safe to distribute.
5. A risky plan
A plan includes a replacement or deletion that the change request did not anticipate. What is your next step?
Review an answer outline
Do not apply the plan automatically. Inspect the resource addresses, dependency changes and configuration inputs; confirm the intended outcome with the owner. Test a corrected plan in an approved environment and retain the review evidence. The objective is safe change management, not making the pipeline green at any cost.
How to practice
Answer each prompt aloud before opening its outline. Score yourself on whether you identified the risk, collected relevant evidence, described a safe decision and explained verification. Revisit any weak topics with Terraform Foundations and the lab catalog. Then use the interview preparation module for additional practice.
Practice more interview questions