opentofu/website/docs/cli/commands/show.mdx
Julien Levasseur 4c0bda5386
Rename website to OpenTofu (#516)
Co-authored-by: Damian Stasik <920747+damianstasik@users.noreply.github.com>
Co-authored-by: Roman Grinovski <roman.grinovski@gmail.com>
2023-09-21 10:57:47 +01:00

54 lines
1.8 KiB
Plaintext

---
description: >-
The `tofu show` command is used to provide human-readable output from a
state or plan file. This can be used to inspect a plan to ensure that the
planned operations are expected, or to inspect the current state as OpenTofu
sees it.
---
# Command: show
The `tofu show` command is used to provide human-readable output
from a state or plan file. This can be used to inspect a plan to ensure
that the planned operations are expected, or to inspect the current state
as OpenTofu sees it.
Machine-readable output is generated by adding the `-json` command-line
flag.
:::note
When using the `-json` command-line flag, any sensitive values in
OpenTofu state will be displayed in plain text. For more information, see
[Sensitive Data in State](/docs/language/state/sensitive-data).
:::
## JSON Output
For OpenTofu state files (including when no path is provided),
`tofu show -json` will show a JSON representation of the state.
For OpenTofu plan files, `tofu show -json` will show a JSON representation
of the plan, configuration, and current state.
If you've updated providers which contain new schema versions since the state
was written, the state needs to be upgraded before it can be displayed with
`show -json`. If you are viewing a plan, it must be created without
`-refresh=false`. If you are viewing a state file, run `tofu refresh`
first.
The output format is covered in detail in [JSON Output Format](/docs/internals/json-format).
## Usage
Usage: `tofu show [options] [file]`
You may use `show` with a path to either a OpenTofu state file or plan
file. If you don't specify a file path, OpenTofu will show the latest state
snapshot.
This command accepts the following options:
* `-no-color` - Disables output with coloring
* `-json` - Displays machine-readable output from a state or plan file