Infrastructure as Code (Terraform/OpenTofu)
Compare Infrastructure as Code (Terraform/OpenTofu) with a common alternative (angle 5). How do you decide in a design review?
Answers use simple, clear English.
Quick interview answer
Baseline: Declare cloud resources in code; plan/apply with state. Modules, workspaces/envs, remote state locks.
Detailed answer
Baseline: Declare cloud resources in code; plan/apply with state. Modules, workspaces/envs, remote state locks. Idempotent infra changes reviewed in PR. Prefer when pros dominate: Reviewable, repeatable environments.. Avoid when: State drift; blast radius of bad apply.. Core: Declare cloud resources in code; plan/apply with state. Modules, workspaces/envs, remote state locks. Idempotent infra changes reviewed in PR. Real-time example: PR shows terraform plan +2 aws_s3_bucket; apply on merge to infra main. Pros: Reviewable, repeatable environments. Cons: State drift; blast radius of bad apply. Common mistakes: Manual console changes causing drift; secrets in state. Best practices: Remote state + lock; policy as code (OPA); no drift culture. Audience level: Tech Lead.
Full explanation
Declare cloud resources in code; plan/apply with state. Modules, workspaces/envs, remote state locks. Idempotent infra changes reviewed in PR.
Real example & use case
PR shows terraform plan +2 aws_s3_bucket; apply on merge to infra main.
Pros & cons
Pros: Reviewable, repeatable environments. Cons: State drift; blast radius of bad apply.
Common mistakes
Manual console changes causing drift; secrets in state.
Best practices
Remote state + lock; policy as code (OPA); no drift culture.
Follow-up questions
- How would you test Infrastructure as Code (Terraform/OpenTofu)?
- What metrics prove Infrastructure as Code (Terraform/OpenTofu) is healthy in prod?
- How does Infrastructure as Code (Terraform/OpenTofu) change at 10× traffic?