Command: output
Theterraform output command is used to extract the value of an output variable from the state file.
Usage
output will display all the outputs for the root module. If NAME is specified, only the value of the output specified will be returned.
Options
-
-state=path- Path to the state file to read. Defaults to"terraform.tfstate". Legacy option for the local backend only. See the local backend documentation for more information. -
-no-color- If specified, output won’t contain any color. -
-json- If specified, machine readable output will be printed in JSON format. -
-raw- For value types that can be automatically converted to a string, will print the raw string directly, rather than a human-oriented representation of the value.
Examples
These examples assume the following Terraform output values:sensitive attribute will be redacted.
To query a specific output:
-json, sensitive values are displayed.