SeniorCI/CD & DevOps for QA
How do you test infrastructure as code (Terraform, Pulumi)?
- infrastructure as code
- terraform
- IaC testing
Answer it first, then compare. Nothing here is saved or scored.
Model answer
Testing layers: (1) Linting and validation: terraform validate, tflint. (2) Plan review: terraform plan output in PR comments. (3) Unit tests: test modules in isolation with mock providers (Terratest, terraform test). (4) Integration tests: apply to a test environment, verify resources exist, destroy. (5) Policy tests: OPA/Sentinel to enforce organizational rules (no public S3 buckets, required tags). (6) Drift detection: regularly plan against production to detect manual changes. (7) Cost estimation: infracost to predict cost impact of changes.
What interviewers listen for
- Pipeline shapeYou design stages by failure cost and runtime budget, not by tool feature lists.
- Parallelisation craftYou can shard a real suite and explain the state-isolation choices you made.
- Quality gatesYou know which checks block merge, which warn, and why those defaults are correct.
- Shift-left fluencyYou talk about ownership transfer, not just earlier execution.