Explain the Terraform state file.
⚡
Quick Answer
The state file maps your configuration to the real resources Terraform created, storing their IDs and attributes so Terraform can compute diffs and know what to change, create, or destroy.
Detailed Answer
State is the source of truth Terraform reconciles against, so it must be stored in a shared remote backend (S3, Terraform Cloud) with locking to prevent concurrent corruption, and treated as sensitive (it can contain secrets). Never edit it by hand; use terraform state commands for surgical changes.
💡
Interview Tip
Stress remote backend + state locking + treating state as sensitive — those are the operational must-knows.
terraformstateiac