Explain the Terraform workflow: init, plan, and apply.
What they are really testing: Whether you know plan is a dry-run diff you review before apply makes changes, which is the core safety mechanism of Terraform. Also init for providers/backend.
A real interview question
Explain the Terraform workflow: init, plan, and apply.
What most people say
drag me
“You run terraform apply to create your infrastructure.”
Skipping plan is the tell. plan is the safety mechanism, a dry-run diff you review before apply, and ignoring it is how people accidentally destroy resources. init (providers/backend) is also part of the workflow.
The follow-ups they ask next
Why is reviewing the plan before apply so important?
It shows exactly what will change, including destroys/replaces. A config tweak can force-replace a stateful resource (like a DB); the plan is your chance to catch that before it deletes data. Apply without reading plan is how accidents happen.
What does terraform init actually do?
Downloads the provider plugins the config requires and initializes the backend (where state is stored), plus pulls modules. You run it first and whenever providers/modules/backend change.
What the interviewer is listening for
- Knows plan is a dry-run diff reviewed before apply
- Knows init sets up providers/backend
- Watches for unexpected destroys
What sinks the answer
- Jumps to apply, skips plan
- No notion of reviewing the diff
- Unaware of init/backend
If you genuinely do not know
Say this instead of freezing. Reasoning out loud from what you do know beats silence every single time, and a good interviewer is listening for exactly that.
“Workflow: [init downloads providers and configures the backend (state)], [plan computes and shows the diff, create/change/destroy, without changing anything, a dry run], [apply executes it after you confirm]. The guardrail is [always read the plan before applying, especially watch for unexpected destroys/replaces], which is your chance to catch a dangerous change.”
Keep going with iac & automation
Foundation
What is Infrastructure as Code, and why use it instead of clicking through the console?
Foundation
What is the difference between declarative and imperative infrastructure as code?
Junior
What is Terraform state, and why does it exist?
Mid
Your team provisions infrastructure with code. Why does idempotency matter, and what breaks without it?
Mid
Why do teams use remote state with locking instead of local state?
Mid
What are Terraform modules, and how do they help?
Knowing the answer is not the same as recalling it under pressure
Sign in to send the questions you fumble to spaced recall, so they come back right before you would forget them, and learn the concepts behind them with hands-on labs.
Start free