Someone Changed Infra by Hand. Terraform Plan Is a Mess.
A manual console change put Terraform's state out of sync, and the next plan wants to undo it. Defend how you reconcile it.
Answer key reviewed by Branko Petric
Read first: Terraform State Explained
Your decision
An engineer made a change in the cloud console by hand, and now terraform plan shows a confusing diff that wants to revert their change. State and reality are out of sync. How do you reconcile this safely?
The situation
You run terraform plan before a routine change and get a large, confusing diff: Terraform wants to revert several settings on a load balancer and a security group. Nothing in your code changed.
Context
An on-call engineer made a quick fix directly in the cloud console during an incident last night and did not record it in code. State is in a shared remote backend. You are not yet sure whether their manual change was correct and should stay, or was a temporary hack.
Related challenges
- Terraform Wants to Replace the Database. Apply Now?
A routine terraform plan unexpectedly wants to destroy and recreate the production database. Defend whether to apply, and how.
- One Giant Terraform State Runs Everything
A single Terraform state holds all your infra; every plan is slow and scary. A teammate wants to just keep applying carefully. Defend how you reduce the blast radius.
- Terraform Doesn't Know the Hand-Made DB. Let It Build a New One?
A prod RDS instance was made by hand and Terraform's plan wants to create a new one. A teammate says just apply. Defend what you actually do first.
- Commit terraform.tfstate to the Repo So Everyone Shares It?
A teammate wants to commit terraform.tfstate to git so the whole team shares one state file. Defend the correct way to share Terraform state.