Files
opentf/website/docs/cli/commands/refresh.mdx
Kuba Martin 4d665a0091 Update website/docs/cli. (#171)
* Initial renaming, rewriting and cleaning up wave for the CLI docs.

Signed-off-by: Jakub Martin <kubam@spacelift.io>

* More renaming.

Signed-off-by: Jakub Martin <kubam@spacelift.io>

* More renaming.

Signed-off-by: Jakub Martin <kubam@spacelift.io>

* More renaming.

Signed-off-by: Jakub Martin <kubam@spacelift.io>

* Remove tutorial references.

Signed-off-by: Jakub Martin <kubam@spacelift.io>

* Post-review fixes.

Signed-off-by: Jakub Martin <kubam@spacelift.io>

---------

Signed-off-by: Jakub Martin <kubam@spacelift.io>
2023-08-25 11:09:18 +02:00

60 lines
2.1 KiB
Plaintext

---
page_title: 'Command: refresh'
description: |-
The `opentf refresh` command reads the current settings from all managed
remote objects and updates the OpenTF state to match.
---
# Command: refresh
The `opentf refresh` command reads the current settings from all managed
remote objects and updates the OpenTF state to match.
~> _Warning:_ This command is deprecated, because its default behavior is
unsafe if you have misconfigured credentials for any of your providers.
See below for more information and recommended alternatives.
This won't modify your real remote objects, but it will modify the
[OpenTF state](/opentf/language/state).
You shouldn't typically need to use this command, because OpenTF
automatically performs the same refreshing actions as a part of creating
a plan in both the
[`opentf plan`](/opentf/cli/commands/plan)
and
[`opentf apply`](/opentf/cli/commands/apply)
commands. This command is here primarily for backward compatibility, but
we don't recommend using it because it provides no opportunity to review
the effects of the operation before updating the state.
## Usage
Usage: `opentf refresh [options]`
This command is effectively an alias for the following command:
```
opentf apply -refresh-only -auto-approve
```
Consequently, it supports all of the same options as
[`opentf apply`](/opentf/cli/commands/apply) except that it does not accept a saved
plan file, it doesn't allow selecting a planning mode other than "refresh only",
and `-auto-approve` is always enabled.
Automatically applying the effect of a refresh is risky. If you have
misconfigured credentials for one or more providers, OpenTF may
be misled into thinking that all of the managed objects have been deleted,
causing it to remove all of the tracked objects without any confirmation prompt.
Instead, we recommend using the following command in order to get the same
effect but with the opportunity to review the changes that OpenTF has
detected before committing them to the state:
```
opentf apply -refresh-only
```
This alternative command will present an interactive prompt for you to confirm
the detected changes.