Interview Prep/Terraform/Lost, Corrupted and Drifted State

After an incident, someone changed an EC2 instance type in the console. `terraform plan` now wants to stop and resize it back during business hours.

BeginnerTroubleshootingLost, Corrupted and Drifted State
Answer

Likely causes → Drift on instance_type; the AWS provider changes it in place by stopping and starting the instance.

Diagnose → terraform plan shows ~ instance_type = "m6i.xlarge" -> "m6i.large".

Fix → If the bigger size is now correct, update code and apply (no-op). If not, schedule the resize in a maintenance window.

Prevent → Incident runbooks must include "open a PR to codify any manual change within 24 hours".

All Terraform questions Roadmap: Terraform in production

More on Lost, Corrupted and Drifted State