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