Terraform state interview questions rarely stop at the definition. "What is state?" turns into "where do you keep it?", then "the lock won't release, now what?", then "someone deleted the state file, walk me through the next hour". The questions below follow that path, from backends and locking to splitting a monolith and recovering lost state. For the wider Terraform screen, see 20 Terraform interview questions from real senior interviews ; this post stays on state.
Terraform state interview questions on the basics
1. What does a state file hold, and why can't Terraform just query the cloud?
State maps each resource address in your configuration to the ID of the real object, caches that object's attributes, and records dependencies and output values. Two top-level fields matter in recovery questions: lineage , a unique ID assigned when the state is first created, and serial , which goes up every time the state is written.…