Pcornel
Automation · Rollback & Recovery

State Backup

Cheat sheet · https://pcornel.dk/topic.php?topic=5950

Back to the Topic

Answer

State backup saves tool state such as Terraform state files, databases or inventories before changes, so automation does not lose track of what it manages if a run goes wrong.

Remember

  • Back up tool state like Terraform state before risky runs.
  • Version state storage.
  • Restore if state is damaged.

First checks

  • terraform state pull > state-backup.tfstate — IaC state backup
  • Database/app state backup — data
  • Backend versioning — history

Verify in this order

state → backup → restore when needed

Where it usually breaks

Configuration/input → graph/state refresh → plan → provider API request → provider terminal result → resource read-back → effective service state → workload.

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=5950

Confirmation

Confirm action

Continue?