mirror of
https://github.com/opentffoundation/opentf.git
synced 2025-12-25 01:00:16 -05:00
Change docs links: /opentf-> /docs (#367)
Signed-off-by: Roman Grinovski <roman.grinovski@gmail.com>
This commit is contained in:
@@ -7,7 +7,7 @@ description: The `opentf state` command is used for advanced state management.
|
||||
|
||||
The `opentf state` command is used for advanced state management.
|
||||
As your OpenTF usage becomes more advanced, there are some cases where
|
||||
you may need to modify the [OpenTF state](/opentf/language/state).
|
||||
you may need to modify the [OpenTF state](/docs/language/state).
|
||||
Rather than modify the state directly, the `opentf state` commands can
|
||||
be used in many cases instead.
|
||||
|
||||
@@ -32,7 +32,7 @@ written to disk and the CLI usage is the same as if it were local state.
|
||||
All `opentf state` subcommands that modify the state write backup
|
||||
files. The path of these backup file can be controlled with `-backup`.
|
||||
|
||||
Subcommands that are read-only (such as [list](/opentf/cli/commands/state/list))
|
||||
Subcommands that are read-only (such as [list](/docs/cli/commands/state/list))
|
||||
do not write any backup files since they aren't modifying the state.
|
||||
|
||||
Note that backups for state modification _can not be disabled_. Due to
|
||||
|
||||
@@ -8,7 +8,7 @@ description: >-
|
||||
# Command: state list
|
||||
|
||||
The `opentf state list` command is used to list resources within a
|
||||
[OpenTF state](/opentf/language/state).
|
||||
[OpenTF state](/docs/language/state).
|
||||
|
||||
## Usage
|
||||
|
||||
@@ -24,12 +24,12 @@ within modules are listed last.
|
||||
|
||||
For complex infrastructures, the state can contain thousands of resources.
|
||||
To filter these, provide one or more patterns to the command. Patterns are
|
||||
in [resource addressing format](/opentf/cli/state/resource-addressing).
|
||||
in [resource addressing format](/docs/cli/state/resource-addressing).
|
||||
|
||||
The command-line flags are all optional. The following flags are available:
|
||||
|
||||
* `-state=path` - Path to the state file. Defaults to "opentf.tfstate".
|
||||
Ignored when [remote state](/opentf/language/state/remote) is used.
|
||||
Ignored when [remote state](/docs/language/state/remote) is used.
|
||||
* `-id=id` - ID of resources to show. Ignored when unset.
|
||||
|
||||
## Example: All Resources
|
||||
|
||||
@@ -7,7 +7,7 @@ description: >-
|
||||
|
||||
# Command: state mv
|
||||
|
||||
The main function of [OpenTF state](/opentf/language/state) is
|
||||
The main function of [OpenTF state](/docs/language/state) is
|
||||
to track the bindings between resource instance addresses in your configuration
|
||||
and the remote objects they represent. Normally OpenTF automatically
|
||||
updates the state in response to actions taken when applying a plan, such as
|
||||
@@ -28,7 +28,7 @@ remote objects currently associated with the source to be tracked instead
|
||||
by the destination.
|
||||
|
||||
Both the source and destination addresses must use
|
||||
[resource address syntax](/opentf/cli/state/resource-addressing), and
|
||||
[resource address syntax](/docs/cli/state/resource-addressing), and
|
||||
they must both refer to the same kind of object: you can only move a resource
|
||||
instance to another resource instance, a whole module instance to another
|
||||
whole module instance, etc. Furthermore, if you are moving a resource or
|
||||
@@ -66,22 +66,22 @@ This command also accepts the following options:
|
||||
returning an error. The duration syntax is a number followed by a time
|
||||
unit letter, such as "3s" for three seconds.
|
||||
|
||||
For configurations using the [`cloud` backend](/opentf/cli/cloud) or the [`remote` backend](/opentf/language/settings/backends/remote)
|
||||
For configurations using the [`cloud` backend](/docs/cli/cloud) or the [`remote` backend](/docs/language/settings/backends/remote)
|
||||
only, `opentf state mv`
|
||||
also accepts the option
|
||||
[`-ignore-remote-version`](/opentf/cli/cloud/command-line-arguments#ignore-remote-version).
|
||||
[`-ignore-remote-version`](/docs/cli/cloud/command-line-arguments#ignore-remote-version).
|
||||
|
||||
The legacy options [`-backup` and `-backup-out`](/opentf/language/settings/backends/local#command-line-arguments)
|
||||
The legacy options [`-backup` and `-backup-out`](/docs/language/settings/backends/local#command-line-arguments)
|
||||
operate on a local state file only. Configurations using
|
||||
[the `remote` backend](/opentf/language/settings/backends/remote)
|
||||
must specify a local state file with the [`-state`](/opentf/language/settings/backends/local#command-line-arguments)
|
||||
option in order to use the [`-backup` and `-backup-out`](/opentf/language/settings/backends/local#command-line-arguments)
|
||||
[the `remote` backend](/docs/language/settings/backends/remote)
|
||||
must specify a local state file with the [`-state`](/docs/language/settings/backends/local#command-line-arguments)
|
||||
option in order to use the [`-backup` and `-backup-out`](/docs/language/settings/backends/local#command-line-arguments)
|
||||
options.
|
||||
|
||||
For configurations using
|
||||
[the `local` state mv](/opentf/language/settings/backends/local) only,
|
||||
[the `local` state mv](/docs/language/settings/backends/local) only,
|
||||
`opentf state mv` also accepts the legacy options
|
||||
[`-state`, `-state-out`, `-backup`, and `-backup-out`](/opentf/language/settings/backends/local#command-line-arguments).
|
||||
[`-state`, `-state-out`, `-backup`, and `-backup-out`](/docs/language/settings/backends/local#command-line-arguments).
|
||||
|
||||
## Example: Rename a Resource
|
||||
|
||||
@@ -133,7 +133,7 @@ opentf state mv module.app module.parent.module.app
|
||||
|
||||
## Example: Move a Particular Instance of a Resource using `count`
|
||||
|
||||
A resource defined with [the `count` meta-argument](/opentf/language/meta-arguments/count)
|
||||
A resource defined with [the `count` meta-argument](/docs/language/meta-arguments/count)
|
||||
has multiple instances that are each identified by an integer. You can
|
||||
select a particular instance by including an explicit index in your given
|
||||
address:
|
||||
@@ -158,7 +158,7 @@ The above examples show the typical quoting syntax for Unix-style shells.
|
||||
|
||||
## Example: Move a Resource configured with for_each
|
||||
|
||||
A resource defined with [the `for_each` meta-argument](/opentf/language/meta-arguments/for_each)
|
||||
A resource defined with [the `for_each` meta-argument](/docs/language/meta-arguments/for_each)
|
||||
has multiple instances that are each identified by an string. You can
|
||||
select a particular instance by including an explicit key in your given
|
||||
address.
|
||||
|
||||
@@ -8,7 +8,7 @@ description: >-
|
||||
# Command: state pull
|
||||
|
||||
The `opentf state pull` command is used to manually download and output
|
||||
the state from [remote state](/opentf/language/state/remote). This command also
|
||||
the state from [remote state](/docs/language/state/remote). This command also
|
||||
works with local state.
|
||||
|
||||
## Usage
|
||||
|
||||
@@ -6,7 +6,7 @@ description: The `opentf state push` command pushes items to the OpenTF state.
|
||||
# Command: state push
|
||||
|
||||
The `opentf state push` command is used to manually upload a local
|
||||
state file to [remote state](/opentf/language/state/remote). This command also
|
||||
state file to [remote state](/docs/language/state/remote). This command also
|
||||
works with local state.
|
||||
|
||||
This command should rarely be used. It is meant only as a utility in case
|
||||
@@ -17,7 +17,7 @@ manual intervention is necessary with the remote state.
|
||||
Usage: `opentf state push [options] PATH`
|
||||
|
||||
This command pushes the state specified by PATH to the currently
|
||||
configured [backend](/opentf/language/settings/backends/configuration).
|
||||
configured [backend](/docs/language/settings/backends/configuration).
|
||||
|
||||
If PATH is "-" then the state data to push is read from stdin. This data
|
||||
is loaded completely into memory and verified prior to being written to
|
||||
@@ -42,7 +42,7 @@ Both of these safety checks can be disabled with the `-force` flag.
|
||||
**This is not recommended.** If you disable the safety checks and are
|
||||
pushing state, the destination state will be overwritten.
|
||||
|
||||
For configurations using the [`cloud` backend](/opentf/cli/cloud) or the [`remote` backend](/opentf/language/settings/backends/remote)
|
||||
For configurations using the [`cloud` backend](/docs/cli/cloud) or the [`remote` backend](/docs/language/settings/backends/remote)
|
||||
only, `opentf state push`
|
||||
also accepts the option
|
||||
[`-ignore-remote-version`](/opentf/cli/cloud/command-line-arguments#ignore-remote-version).
|
||||
[`-ignore-remote-version`](/docs/cli/cloud/command-line-arguments#ignore-remote-version).
|
||||
|
||||
@@ -8,7 +8,7 @@ description: >-
|
||||
# Command: state replace-provider
|
||||
|
||||
The `opentf state replace-provider` command is used to replace the provider
|
||||
for resources in a [OpenTF state](/opentf/language/state).
|
||||
for resources in a [OpenTF state](/docs/language/state).
|
||||
|
||||
## Usage
|
||||
|
||||
@@ -32,15 +32,15 @@ This command also accepts the following options:
|
||||
|
||||
- `-lock-timeout=0s` - Duration to retry a state lock.
|
||||
|
||||
For configurations using the [`cloud` backend](/opentf/cli/cloud) or the [`remote` backend](/opentf/language/settings/backends/remote)
|
||||
For configurations using the [`cloud` backend](/docs/cli/cloud) or the [`remote` backend](/docs/language/settings/backends/remote)
|
||||
only, `opentf state replace-provider`
|
||||
also accepts the option
|
||||
[`-ignore-remote-version`](/opentf/cli/cloud/command-line-arguments#ignore-remote-version).
|
||||
[`-ignore-remote-version`](/docs/cli/cloud/command-line-arguments#ignore-remote-version).
|
||||
|
||||
For configurations using
|
||||
[the `local` state](/opentf/language/settings/backends/local) only,
|
||||
[the `local` state](/docs/language/settings/backends/local) only,
|
||||
`opentf state replace-provider` also accepts the legacy options
|
||||
[`-state`, `-state-out`, and `-backup`](/opentf/language/settings/backends/local#command-line-arguments).
|
||||
[`-state`, `-state-out`, and `-backup`](/docs/language/settings/backends/local#command-line-arguments).
|
||||
|
||||
## Example
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ description: >-
|
||||
|
||||
# Command: state rm
|
||||
|
||||
The main function of [OpenTF state](/opentf/language/state) is
|
||||
The main function of [OpenTF state](/docs/language/state) is
|
||||
to track the bindings between resource instance addresses in your configuration
|
||||
and the remote objects they represent. Normally OpenTF automatically
|
||||
updates the state in response to actions taken when applying a plan, such as
|
||||
@@ -23,13 +23,13 @@ to exist in the remote system.
|
||||
Usage: `opentf state rm [options] ADDRESS...`
|
||||
|
||||
OpenTF will search the state for any instances matching the given
|
||||
[resource address](/opentf/cli/state/resource-addressing), and remove
|
||||
[resource address](/docs/cli/state/resource-addressing), and remove
|
||||
the record of each one so that OpenTF will no longer be tracking the
|
||||
corresponding remote objects.
|
||||
|
||||
This means that although the objects will still continue to exist in the
|
||||
remote system, a subsequent
|
||||
[`opentf plan`](/opentf/cli/commands/plan)
|
||||
[`opentf plan`](/docs/cli/commands/plan)
|
||||
will include an action to create a new object for each of the "forgotten"
|
||||
instances. Depending on the constraints imposed by the remote system, creating
|
||||
those objects might fail if their names or other identifiers conflict with
|
||||
@@ -49,15 +49,15 @@ This command also accepts the following options:
|
||||
returning an error. The duration syntax is a number followed by a time
|
||||
unit letter, such as "3s" for three seconds.
|
||||
|
||||
For configurations using the [`cloud` backend](/opentf/cli/cloud) or the [`remote` backend](/opentf/language/settings/backends/remote)
|
||||
For configurations using the [`cloud` backend](/docs/cli/cloud) or the [`remote` backend](/docs/language/settings/backends/remote)
|
||||
only, `opentf state rm`
|
||||
also accepts the option
|
||||
[`-ignore-remote-version`](/opentf/cli/cloud/command-line-arguments#ignore-remote-version).
|
||||
[`-ignore-remote-version`](/docs/cli/cloud/command-line-arguments#ignore-remote-version).
|
||||
|
||||
For configurations using
|
||||
[the `local` state rm](/opentf/language/settings/backends/local) only,
|
||||
[the `local` state rm](/docs/language/settings/backends/local) only,
|
||||
`opentf state rm` also accepts the legacy options
|
||||
[`-state`, `-state-out`, and `-backup`](/opentf/language/settings/backends/local#command-line-arguments).
|
||||
[`-state`, `-state-out`, and `-backup`](/docs/language/settings/backends/local#command-line-arguments).
|
||||
|
||||
## Example: Remove all Instances of a Resource
|
||||
|
||||
@@ -92,7 +92,7 @@ $ opentf state rm 'module.foo'
|
||||
|
||||
## Example: Remove a Particular Instance of a Resource using `count`
|
||||
|
||||
A resource defined with [the `count` meta-argument](/opentf/language/meta-arguments/count)
|
||||
A resource defined with [the `count` meta-argument](/docs/language/meta-arguments/count)
|
||||
has multiple instances that are each identified by an integer. You can
|
||||
select a particular instance by including an explicit index in your given
|
||||
address:
|
||||
@@ -107,7 +107,7 @@ The above shows the typical quoting syntax for Unix-style shells.
|
||||
|
||||
## Example: Remove a Particular Instance of a Resource using `for_each`
|
||||
|
||||
A resource defined with [the `for_each` meta-argument](/opentf/language/meta-arguments/for_each)
|
||||
A resource defined with [the `for_each` meta-argument](/docs/language/meta-arguments/for_each)
|
||||
has multiple instances that are each identified by an string. You can
|
||||
select a particular instance by including an explicit key in your given
|
||||
address.
|
||||
|
||||
@@ -9,7 +9,7 @@ description: >-
|
||||
|
||||
The `opentf state show` command is used to show the attributes of a
|
||||
single resource in the
|
||||
[OpenTF state](/opentf/language/state).
|
||||
[OpenTF state](/docs/language/state).
|
||||
|
||||
## Usage
|
||||
|
||||
@@ -20,16 +20,16 @@ state file that matches the given address.
|
||||
|
||||
This command requires an address that points to a single resource in the
|
||||
state. Addresses are
|
||||
in [resource addressing format](/opentf/cli/state/resource-addressing).
|
||||
in [resource addressing format](/docs/cli/state/resource-addressing).
|
||||
|
||||
The command-line flags are all optional. The following flags are available:
|
||||
|
||||
* `-state=path` - Path to the state file. Defaults to "opentf.tfstate".
|
||||
Ignored when [remote state](/opentf/language/state/remote) is used.
|
||||
Ignored when [remote state](/docs/language/state/remote) is used.
|
||||
|
||||
The output of `opentf state show` is intended for human consumption, not
|
||||
programmatic consumption. To extract state data for use in other software, use
|
||||
[`opentf show -json`](/opentf/cli/commands/show#json-output) and decode the result
|
||||
[`opentf show -json`](/docs/cli/commands/show#json-output) and decode the result
|
||||
using the documented structure.
|
||||
|
||||
## Example: Show a Resource
|
||||
@@ -60,7 +60,7 @@ $ opentf state show 'module.foo.packet_device.worker'
|
||||
## Example: Show a Resource configured with count
|
||||
|
||||
The example below shows the first instance of a `packet_device` resource named `worker` configured with
|
||||
[`count`](/opentf/language/meta-arguments/count):
|
||||
[`count`](/docs/language/meta-arguments/count):
|
||||
|
||||
```shell
|
||||
$ opentf state show 'packet_device.worker[0]'
|
||||
@@ -68,7 +68,7 @@ $ opentf state show 'packet_device.worker[0]'
|
||||
|
||||
## Example: Show a Resource configured with for_each
|
||||
|
||||
The following example shows the `"example"` instance of a `packet_device` resource named `worker` configured with the [`for_each`](/opentf/language/meta-arguments/for_each) meta-argument. You must place the resource name in single quotes when it contains special characters like double quotes.
|
||||
The following example shows the `"example"` instance of a `packet_device` resource named `worker` configured with the [`for_each`](/docs/language/meta-arguments/for_each) meta-argument. You must place the resource name in single quotes when it contains special characters like double quotes.
|
||||
|
||||
Linux, Mac OS, and UNIX:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user