Interview prompt
Explain infrastructure changes need reviewable state to an engineer who understands the surrounding system but has not used this technique. Walk from its contract to a concrete operation, then discuss where it fails or becomes expensive.
A strong answer
Infrastructure as code describes resources and their relationships in versioned files. A planning step compares the declared target with provider state and proposes changes. This makes infrastructure reviewable alongside application changes, but the plan is only as trustworthy as its inputs and state handling.
A change that adds a database replica can be reviewed for cost, networking, and failover consequences before apply. State records resource identities so the tool can update existing resources rather than create duplicates. Remote state storage and locking help teams coordinate concurrent changes.
A complete answer also calls out the assumptions that control correctness. Drift occurs when real infrastructure changes outside the declared workflow or provider state becomes stale. Applying a broad plan can replace resources or expose secrets if review misses destructive effects. Secrets should not be committed in plain text, and state files often contain sensitive values.
Close by describing one representative test or measurement. A plan proposes replacing a production database after a naming change. What should reviewers check before applying it, and how can resource identity be preserved?
Follow-up questions
Answer the follow-ups in the frontmatter. Use the linked article for the concept and the trace to make the explanation concrete.