What is the Terraform state file and why does it matter?
⚡
Quick Answer
State maps your configuration to real resources; Terraform uses it to plan changes and detect drift.
Detailed Answer
terraform.tfstate records resource IDs and metadata so Terraform knows what it manages. Without it, Terraform can't map config to reality. It can contain secrets, so store it in an encrypted remote backend, never in Git. Losing state means Terraform no longer knows about your infrastructure.
💡
Interview Tip
Stress: remote, encrypted, locked — never in Git.
terraformstatebackend