Design infrastructure as code like terraform
PremiumCloud infrastructureMedium
- Terraform
- State locking
- Plan and apply
Quick answer
This cloud infrastructure interview question asks you to design infrastructure as code like terraform. Aim for a design that runs reliably and securely in the cloud at a sensible cost, then explain the services, regions, deployment and trade-offs. Interviewers want to see how you balance reliability, security and cost.
The problem
Design infrastructure as code like Terraform, plus the service that runs it for a whole company: engineers describe cloud resources in config files, the tool shows a plan and then applies it. The hard parts are keeping the state file correct, stopping two applies from racing, and catching drift.
The tool reads config, builds a dependency graph (a subnet needs its network first), compares desired config with recorded state refreshed against the real cloud, and shows a plan of creates, updates, replacements and deletes. Apply carries out the plan through provider plugins that call cloud APIs.
What must the system do?
- Plan: For a workspace, show exactly which resources will be created, updated in place, replaced or destroyed, before anything changes.
- Apply: Execute an approved plan in dependency order, in parallel where the graph allows, and record each result in state.
How well must it do it?
- State correctness: State is never lost, corrupted or written by two applies at once; every version is kept for 90 days.
- Apply what was reviewed: An apply runs only the reviewed plan; if state changed since that plan, the apply refuses.
What scale should you design for?
Use these numbers in your estimates.
The scale numbers unlock with this questionUnlock
Key concepts
- Terraform
- State locking
- Plan and apply
- Dependency graph
- Drift detection
- Remote state
How you’ll practise
- Requirements
- Environments and topology
- Deployment pipeline
- Reliability and disaster recovery
- Observability and cost
- Wrap-up
Lala, personalized to you, gives a hint when you ask and reviews your design when you are ready.
What do interviewers look for?
In any cloud infrastructure design round.
- Clarifies availability, security and cost targets
- Chooses managed services with reasons
- Plans regions, zones and failover
- Covers identity, secrets and network boundaries
- Explains deployment, rollback and observability
- Keeps an eye on cost as usage grows
Questions people ask about this interview question
- Which design type is this question?
- It is a cloud infrastructure question. You design infrastructure as code like terraform and explain your choices the way you would in an interview.
- Is this question asked at entry level?
- It is marked Medium. Entry-level engineers can practise it, but it expects you to reason about requirements and trade-offs, not only list components.
- What should I cover first?
- Start with the workloads, the availability target and the security and cost limits. Agree on scope with the interviewer before you design anything.
- Can I practise it for free?
- It is a premium question. Sign up and unlock it once for 10 credits; it then stays unlocked. When you finish, Lala, your personalized AI mentor, can review your design for 30 credits.
Related questions
- Design an application health check systemCloud infrastructure · EasyPremium
- Design a distributed software release orchestration platformCloud infrastructure · HardPremium
- Design a multi-cloud disaster recovery orchestration platformCloud infrastructure · HardPremium
- Design a global infrastructure change approval & risk assessment platformCloud infrastructure · HardPremium
Updated · Written by the SevyDevy team