docs: terraform state show is not machine-readable

In earlier versions of Terraform the result of terraform state show was
in the pre-0.12 "flatmap" structure that was unable to reflect nested
data structures. That was fixed in Terraform 0.12, but as a consequence
this statement about the output being machine-parseable (which was
debateable even in older versions) is incorrect.

Fortunately, we now have "terraform show -json" to get output that is
intentionally machine-parseable, so we'll recommend to use that instead
here. The JSON output of that command is a superset of what's produced by
"terraform state show", so should be usable to meet any use-case that
might previously have been met by parsing the "terraform state show"
output.
This commit is contained in:
Martin Atkins 2020-01-06 15:44:30 -08:00
parent 2b2ac1f6de
commit 2a95d98383
1 changed files with 5 additions and 4 deletions

View File

@ -19,10 +19,6 @@ Usage: `terraform state show [options] ADDRESS`
The command will show the attributes of a single resource in the
state file that matches the given address.
The attributes are listed in alphabetical order (with the except of "id"
which is always at the top). They are outputted in a way that is easy
to parse on the command-line.
This command requires an address that points to a single resource in the
state. Addresses are
in [resource addressing format](/docs/commands/state/addressing.html).
@ -32,6 +28,11 @@ The command-line flags are all optional. The list of available flags are:
* `-state=path` - Path to the state file. Defaults to "terraform.tfstate".
Ignored when [remote state](/docs/state/remote.html) is used.
The output of `terraform state show` is intended for human consumption, not
programmatic consumption. To extract state data for use in other software, use
[`terraform show -json`](../show.html#json-output) and decode the result
using the documented structure.
## Example: Show a Resource
The example below shows a `packet_device` resource named `worker`: