Skip to main content
RunBook Academy

← All break/fix scenarios in Terraform

advancedterraform-state~25 min

State Out of Sync After Failed Apply

Reported symptoms

  • The apply failed
  • The state shows different attributes than the real world
  • The plan proposes changes that should not be needed

Evidence

  • · The apply log
  • · The state attributes
  • · The real-world attributes
Diagnosis and resolutionclick to reveal

Root cause

The apply partially completed before failing. The state reflects the partial changes, but the real world is in a different state. The state is now inconsistent with the real world.

Remediation

1. Do not re-apply blindly. 2. Investigate the failure. 3. Refresh the state. 4. Identify what is in the state but not in the real world. 5. Manually reconcile.

Verification

The state matches the real world, the plan is empty, and the incident is documented.

Prevention

1. Use refresh-only plans after apply failures. 2. Use saved-plan apply to ensure the apply matches the plan.

State Out of Sync After Failed Apply

The apply partially completed before failing. The state reflects the partial changes, but the real world is in a different state. The state is now inconsistent with the real world.