2020-10-27 02:15:36 +01:00
|
|
|
---
|
|
|
|
layout: "docs"
|
|
|
|
page_title: "Recovering from State Disasters - Terraform CLI"
|
2021-07-23 21:47:49 +02:00
|
|
|
descriptin: "Commands to help you restore state backups and override Terraform state protections."
|
2020-10-27 02:15:36 +01:00
|
|
|
---
|
|
|
|
|
|
|
|
# Recovering from State Disasters
|
|
|
|
|
|
|
|
If something has gone horribly wrong (possibly due to accidents when performing
|
|
|
|
other state manipulation actions), you might need to take drastic actions with
|
|
|
|
your state data.
|
|
|
|
|
2021-01-19 22:43:01 +01:00
|
|
|
- [The `terraform force-unlock` command](/docs/cli/commands/force-unlock.html) can
|
2020-10-27 02:15:36 +01:00
|
|
|
override the protections Terraform uses to prevent two processes from
|
|
|
|
modifying state at the same time. You might need this if a Terraform process
|
|
|
|
(like a normal apply) is unexpectedly terminated (like by the complete
|
|
|
|
destruction of the VM it's running in) before it can release its lock on the
|
|
|
|
state backend. Do not run this until you are completely certain what happened
|
|
|
|
to the process that caused the lock to get stuck.
|
|
|
|
|
2021-01-19 22:43:01 +01:00
|
|
|
- [The `terraform state pull` command](/docs/cli/commands/state/pull.html) and
|
|
|
|
[the `terraform state push` command](/docs/cli/commands/state/push.html) can
|
2020-10-27 02:15:36 +01:00
|
|
|
directly read and write entire state files from and to the configured backend.
|
|
|
|
You might need this for obtaining or restoring a state backup.
|
|
|
|
|