Infrastructure as Code Questions
Part of the Cloud Computing Roadmap
In short
IaC questions quickly move past 'what is Terraform'. Expect state, drift, modules and how you'd split environments, because those are where real projects go wrong.
'Walk me through how you'd structure Terraform for a multi-environment setup' — testing real IaC experience and state management understanding from Phase 10.

Think of it like this
The rangoli stencil
Freehand rangoli comes out a little different every time. With a stencil, you get the exact same pattern on every doorstep. Change the stencil once and every new rangoli changes too. Infrastructure as code is the stencil; the cloud resources are the rangolis.
Watch it happen
What plan and apply really do
plan
1/6You ask the tool to compare your code with what exists.
The big ideas
What you need to know
State is the memory
State maps your code to real resource IDs. Lose or corrupt it and the tool no longer knows what it owns.
Drift
Drift is when someone changes a resource by hand. Plan shows it; the fix is to update code or reapply.
Modules
Reusable building blocks with inputs and outputs. Good answers mention versioning modules so changes roll out safely.
Declarative
You describe the end result, not the steps. Running it twice with no changes should do nothing.
See it in code
Walk through the code
1terraform fmt -check && terraform validate2terraform plan -out=tfplan # save the exact plan3terraform apply tfplan # apply only what was reviewed4 5terraform state list # what does state think it manages?6terraform plan -refresh-only # show drift without changing anything7 8# Bring an existing, hand-made bucket under management9terraform import aws_s3_bucket.logs my-company-logs1/3Format and validate, then save the plan so apply does exactly what was reviewed, even if code changed since.
Recent Terraform versions also support import blocks in code. OpenTofu, Pulumi and CloudFormation have the same ideas under different names.
Save yourself the pain
Common mistakes
Oops
Saying you'd fix state problems by editing the state file by hand.
Do this instead
Use tool commands like state mv, state rm and import, after backing up state. Hand edits can break it badly.
Oops
Describing one giant root folder for every environment and service.
Do this instead
Explain splitting by environment and component, so a change to dev networking can't touch prod databases.
Your mission
Cause and fix drift
Quick check
You run terraform apply twice in a row with no code changes. What should the second run do?
Go deeper
- 1Review Phase 10 and practice explaining module structure and state management clearly.
- 2Prepare a real example from your Phase 14 IaC project if you built one.
- 3Practice explaining why remote state and locking matter for team collaboration.
More automation & operations at this stop
Stuck on this topic? Ask an Insider
Get 1:1 guidance from people who've walked this exact path — on the InsideEdge app.