Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions content/terraform/v1.13.x/docs/cli/commands/output.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,43 @@ refer to [Manage sensitive data](/terraform/language/manage-sensitive-data).

## Examples

Get output of a module:
(c) https://stackoverflow.com/questions/52503528/why-is-my-terraform-output-not-working-in-module#After%20Terraform%200.12

- Before Terraform 0.12

The below command shows the output for a specific module

`terraform output -module=example_module`

- After Terraform 0.12

The below command fails in Terraform 0.12 and above with an error:

```hcl
terraform output -module=example_module

Error: Unsupported option

The -module option is no longer supported since Terraform 0.12, because now
only root outputs are persisted in the state.
```

To get outputs from a module in Terraform 0.12 and above, you must export them from the root (e.g example_module) module using an output block in the caller module.

This can be now done simply by adding one line in the caller module like below:

```hcl
output "example_module_outputs" {
value = module.example_module
}
```
Now you can see the output running the following command:

`terraform output`



These examples assume the following Terraform output snippet.

```hcl
Expand Down
Loading