mirror of
https://github.com/opentffoundation/opentf.git
synced 2025-12-25 01:00:16 -05:00
Versioned docs: replacing docs links with relative variants (#1537)
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>
This commit is contained in:
@@ -6,7 +6,7 @@ description: >-
|
||||
|
||||
# Manipulating OpenTofu State
|
||||
|
||||
OpenTofu uses [state data](/docs/language/state) to remember which
|
||||
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.
|
||||
@@ -18,12 +18,12 @@ infrastructure.
|
||||
|
||||
OpenTofu CLI supports several workflows for interacting with state:
|
||||
|
||||
- [Inspecting State](/docs/cli/state/inspect)
|
||||
- [Forcing Re-creation](/docs/cli/state/taint)
|
||||
- [Moving Resources](/docs/cli/state/move)
|
||||
- [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](/docs/cli/import) section)
|
||||
- [Disaster Recovery](/docs/cli/state/recover)
|
||||
[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
|
||||
|
||||
@@ -7,14 +7,14 @@ description: Commands that allow you to read and update state.
|
||||
OpenTofu includes some commands for reading and updating state without taking
|
||||
any other actions.
|
||||
|
||||
- [The `tofu state list` command](/docs/cli/commands/state/list)
|
||||
- [The `tofu state list` command](../commands/state/list.mdx)
|
||||
shows the resource addresses for every resource OpenTofu knows about in a
|
||||
configuration, optionally filtered by partial resource address.
|
||||
|
||||
- [The `tofu state show` command](/docs/cli/commands/state/show)
|
||||
- [The `tofu state show` command](../commands/state/show.mdx)
|
||||
displays detailed state data about one resource.
|
||||
|
||||
- [The `tofu refresh` command](/docs/cli/commands/refresh) updates
|
||||
- [The `tofu refresh` command](../commands/refresh.mdx) updates
|
||||
state data to match the real-world condition of the managed resources. This is
|
||||
done automatically during plans and applies, but not when interacting with
|
||||
state directly.
|
||||
|
||||
@@ -7,7 +7,7 @@ description: >-
|
||||
# Moving Resources
|
||||
|
||||
OpenTofu's state associates each real-world object with a configured resource
|
||||
at a specific [resource address](/docs/cli/state/resource-addressing). This
|
||||
at a specific [resource address](resource-addressing.mdx). This
|
||||
is seamless when changing a resource's attributes, but OpenTofu will lose track
|
||||
of a resource if you change its name, move it to a different module, or change
|
||||
its provider.
|
||||
@@ -21,24 +21,24 @@ can explicitly tell OpenTofu to associate it with a different configured
|
||||
resource.
|
||||
|
||||
For most cases we recommend using
|
||||
[the OpenTofu language's refactoring features](/docs/language/modules/develop/refactoring)
|
||||
[the OpenTofu language's refactoring features](../../language/modules/develop/refactoring.mdx)
|
||||
to document in your module exactly how the resource names have changed over
|
||||
time. OpenTofu reacts to this information automatically during planning, so users of your module do not need to take any unusual extra steps.
|
||||
|
||||
There are some other situations which require explicit state modifications,
|
||||
though. For those, consider the following OpenTofu commands:
|
||||
|
||||
- [The `tofu state mv` command](/docs/cli/commands/state/mv) changes
|
||||
- [The `tofu state mv` command](../commands/state/mv.mdx) changes
|
||||
which resource address in your configuration is associated with a particular
|
||||
real-world object. Use this to preserve an object when renaming a resource, or
|
||||
when moving a resource into or out of a child module.
|
||||
|
||||
- [The `tofu state rm` command](/docs/cli/commands/state/rm) tells
|
||||
- [The `tofu state rm` command](../commands/state/rm.mdx) tells
|
||||
OpenTofu to stop managing a resource as part of the current working directory
|
||||
and workspace, _without_ destroying the corresponding real-world object. (You
|
||||
can later use `tofu import` to start managing that resource in a
|
||||
different workspace or a different OpenTofu configuration.)
|
||||
|
||||
- [The `tofu state replace-provider` command](/docs/cli/commands/state/replace-provider)
|
||||
- [The `tofu state replace-provider` command](../commands/state/replace-provider.mdx)
|
||||
transfers existing resources to a new provider without requiring them to be
|
||||
re-created.
|
||||
|
||||
@@ -10,7 +10,7 @@ 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.
|
||||
|
||||
- [The `tofu force-unlock` command](/docs/cli/commands/force-unlock) can
|
||||
- [The `tofu force-unlock` command](../commands/force-unlock.mdx) can
|
||||
override the protections OpenTofu uses to prevent two processes from
|
||||
modifying state at the same time. You might need this if a OpenTofu process
|
||||
(like a normal apply) is unexpectedly terminated (like by the complete
|
||||
@@ -18,7 +18,7 @@ your state data.
|
||||
state backend. Do not run this until you are completely certain what happened
|
||||
to the process that caused the lock to get stuck.
|
||||
|
||||
- [The `tofu state pull` command](/docs/cli/commands/state/pull) and
|
||||
[the `tofu state push` command](/docs/cli/commands/state/push) can
|
||||
- [The `tofu state pull` command](../commands/state/pull.mdx) and
|
||||
[the `tofu state push` command](../commands/state/push.mdx) can
|
||||
directly read and write entire state files from and to the configured backend.
|
||||
You might need this for obtaining or restoring a state backup.
|
||||
|
||||
@@ -17,7 +17,7 @@ to the problem, because OpenTofu only directly manages the machine as a whole.
|
||||
|
||||
If you know that an object is damaged, or if you want to force OpenTofu to
|
||||
replace it for any other reason, you can override OpenTofu's default behavior
|
||||
using [the `-replace=...` planning option](/docs/cli/commands/plan#replace-address)
|
||||
using [the `-replace=...` planning option](../commands/plan.mdx#replace-address)
|
||||
when you run either `tofu plan` or `tofu apply`:
|
||||
|
||||
```shellsession
|
||||
@@ -52,11 +52,11 @@ address using `-replace=...` as described above.
|
||||
|
||||
If OpenTofu has marked an object as tainted but you consider it to be working
|
||||
correctly and do not want to replace it, you can override OpenTofu's
|
||||
determination using [the `tofu untaint` command](/docs/cli/commands/untaint),
|
||||
determination using [the `tofu untaint` command](../commands/untaint.mdx),
|
||||
after which OpenTofu will consider the object to be ready for use by any
|
||||
downstream resource declarations.
|
||||
|
||||
You can also _force_ OpenTofu to mark a particular object as tainted using
|
||||
[the `tofu taint` command](/docs/cli/commands/taint), but that approach is
|
||||
[the `tofu taint` command](../commands/taint.mdx), but that approach is
|
||||
deprecated in favor of the `-replace=...` option, which avoids the need to
|
||||
create an interim state snapshot with a tainted object.
|
||||
|
||||
Reference in New Issue
Block a user