github.com/rstandt/terraform@v0.12.32-0.20230710220336-b1063613405c/website/docs/configuration-0-11/outputs.html.md (about) 1 --- 2 layout: "docs" 3 page_title: "Output Values - 0.11 Configuration Language" 4 sidebar_current: "docs-conf-old-outputs" 5 description: |- 6 Outputs define values that will be highlighted to the user when Terraform applies, and can be queried easily using the output command. Output usage is covered in more detail in the getting started guide. This page covers configuration syntax for outputs. 7 --- 8 9 # Output Values 10 11 -> **Note:** This page is about Terraform 0.11 and earlier. For Terraform 0.12 12 and later, see 13 [Configuration Language: Output Values](../configuration/outputs.html). 14 15 Outputs define values that will be highlighted to the user 16 when Terraform applies, and can be queried easily using the 17 [output command](/docs/commands/output.html). 18 19 Terraform knows a lot about the infrastructure it manages. 20 Most resources have attributes associated with them, and 21 outputs are a way to easily extract and query that information. 22 23 This page assumes you are familiar with the 24 [configuration syntax](./syntax.html) 25 already. 26 27 ## Example 28 29 A simple output configuration looks like the following: 30 31 ```hcl 32 output "address" { 33 value = "${aws_instance.db.public_dns}" 34 } 35 ``` 36 37 This will output a string value corresponding to the public 38 DNS address of the Terraform-defined AWS instance named "db". It 39 is possible to export complex data types like maps and lists as 40 well: 41 42 ```hcl 43 output "addresses" { 44 value = ["${aws_instance.web.*.public_dns}"] 45 } 46 ``` 47 48 ## Description 49 50 The `output` block configures a single output variable. Multiple 51 output variables can be configured with multiple output blocks. 52 The `NAME` given to the output block is the name used to reference 53 the output variable, and can include letters, numbers, underscores (`_`), 54 and hyphens (`-`). 55 56 Within the block (the `{ }`) is configuration for the output. 57 These are the parameters that can be set: 58 59 - `value` (required) - The value of the output. This can be a string, list, or 60 map. This usually includes an interpolation since outputs that are static 61 aren't usually useful. 62 63 - `description` (optional) - A human-friendly description for the output. This 64 is primarily for documentation for users using your Terraform configuration. A 65 future version of Terraform will expose these descriptions as part of some 66 Terraform CLI command. 67 68 - `depends_on` (list of strings) - Explicit dependencies that this output has. 69 These dependencies will be created before this output value is processed. The 70 dependencies are in the format of `TYPE.NAME`, for example `aws_instance.web`. 71 72 - `sensitive` (optional, boolean) - See below. 73 74 ## Syntax 75 76 The full syntax is: 77 78 ```text 79 output NAME { 80 value = VALUE 81 } 82 ``` 83 84 ## Sensitive Outputs 85 86 Outputs can be marked as containing sensitive material by setting the 87 `sensitive` attribute to `true`, like this: 88 89 ```hcl 90 output "sensitive" { 91 sensitive = true 92 value = VALUE 93 } 94 ``` 95 96 When outputs are displayed on-screen following a `terraform apply` or 97 `terraform refresh`, sensitive outputs are redacted, with `<sensitive>` 98 displayed in place of their value. 99 100 ### Limitations of Sensitive Outputs 101 102 - The values of sensitive outputs are still stored in the Terraform state, and 103 available using the `terraform output` command, so cannot be relied on as a 104 sole means of protecting values. 105 106 - Sensitivity is not tracked internally, so if the output is interpolated in 107 another module into a resource, the value will be displayed.