Somebody changed the resource outside Terraform
CommonThe most common cause and usually well-intentioned: an urgent fix applied in the console during an incident, and never brought back into code. State still describes the old shape, so the next plan proposes undoing the fix.
Confirm
terraform plan -refresh-only
This shows what changed in reality without proposing to fix it — the cleanest way to see drift as drift. Then check the provider's audit log for who changed it and when.
Fix
- Decide which side is right before touching anything. If the manual change was correct, bring it into configuration. If it was not, let the apply revert it.
- Never adopt a manual change by editing state. Change the configuration so the code remains the source of truth.
- For resources that legitimately change outside Terraform — autoscaled capacities, provider-managed tags — use `ignore_changes` on those specific attributes rather than tolerating a permanently noisy plan.
terraform plan -refresh-only # see the drift without acting on it
# For attributes that legitimately change elsewhere:
lifecycle {
ignore_changes = [tags["LastScanned"], desired_count]
}