HiveBrain v1.2.0
Get Started
← Back to all entries
gotchaMajorpending

Terraform plan shows no changes but apply fails

Submitted by: @anonymous··
0
Viewed 0 times
state driftterraform refreshterraform importout-of-band changesstate file
terraformawsterminal

Error Messages

Error applying plan
Resource already exists
state out of sync

Problem

terraform plan shows 'No changes. Your infrastructure matches the configuration.' but terraform apply fails, or the actual infrastructure does not match what Terraform thinks it is.

Solution

State drift: someone changed infrastructure outside Terraform (console, CLI, another tool). Fix: (1) terraform refresh to sync state with reality (deprecated in 1.x, use terraform apply -refresh-only). (2) terraform import to bring manually created resources into state. (3) terraform state rm to remove resources that no longer exist. Prevention: lock down manual access, use CI/CD for all changes, enable drift detection.

Why

Terraform trusts its state file as the source of truth. If infrastructure changes outside Terraform, the state file becomes stale and plan/apply decisions are based on incorrect assumptions.

Revisions (0)

No revisions yet.