mirror of
https://github.com/opentffoundation/opentf.git
synced 2025-12-23 03:34:30 -05:00
Signed-off-by: Janos <86970079+janosdebugs@users.noreply.github.com> Signed-off-by: Damian Stasik <920747+damianstasik@users.noreply.github.com> Signed-off-by: Roman Grinovski <roman.grinovski@gmail.com> Co-authored-by: Damian Stasik <920747+damianstasik@users.noreply.github.com> Co-authored-by: Roman Grinovski <roman.grinovski@gmail.com>
34 lines
1.3 KiB
Plaintext
34 lines
1.3 KiB
Plaintext
---
|
|
description: >-
|
|
State data tracks which real-world object corresponds to each resource.
|
|
Inspect state, move or import resources, and more.
|
|
---
|
|
|
|
# Manipulating OpenTofu State
|
|
|
|
OpenTofu uses [state data](../../language/state/index.mdx) to remember which
|
|
real-world object corresponds to each resource in the configuration;
|
|
this allows it to modify an existing object when its resource declaration
|
|
changes.
|
|
|
|
OpenTofu updates state automatically during plans and applies. However, it's
|
|
sometimes necessary to make deliberate adjustments to OpenTofu's state data,
|
|
usually to compensate for changes to the configuration or the real managed
|
|
infrastructure.
|
|
|
|
OpenTofu CLI supports several workflows for interacting with state:
|
|
|
|
- [Inspecting State](../../cli/state/inspect.mdx)
|
|
- [Forcing Re-creation](../../cli/state/taint.mdx)
|
|
- [Moving Resources](../../cli/state/move.mdx)
|
|
- Importing Pre-existing Resources (documented in the
|
|
[Importing Infrastructure](../../cli/import/index.mdx) section)
|
|
- [Disaster Recovery](../../cli/state/recover.mdx)
|
|
|
|
:::warning Important
|
|
Modifying state data outside a normal plan or apply can cause
|
|
OpenTofu to lose track of managed resources, which might waste money, annoy
|
|
your colleagues, or even compromise the security of your operations. Make sure
|
|
to keep backups of your state data when modifying state out-of-band.
|
|
:::
|