github.com/minamijoyo/terraform@v0.7.8-0.20161029001309-18b3736ba44b/website/source/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  ```ruby
    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 strings as
    39  well:
    40  
    41  ```ruby
    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.
    53  
    54  Within the block (the `{ }`) is configuration for the output.
    55  These are the parameters that can be set:
    56  
    57    * `value` (required) - The value of the output. This can be a string, list,
    58      or map. This usually includes an interpolation since outputs that are
    59      static aren't usually useful.
    60  
    61    * `sensitive` (optional, boolean) - See below.
    62  
    63  ## Syntax
    64  
    65  The full syntax is:
    66  
    67  ```ruby
    68  output NAME {
    69    value = VALUE
    70  }
    71  ```
    72  
    73  ## Sensitive Outputs
    74  
    75  Outputs can be marked as containing sensitive material by setting the
    76  `sensitive` attribute to `true`, like this:
    77  
    78  ```ruby
    79  output "sensitive" {
    80    sensitive = true
    81    value     = VALUE
    82  }
    83  ```
    84  
    85  When outputs are displayed on-screen following a `terraform apply` or
    86  `terraform refresh`, sensitive outputs are redacted, with `<sensitive>`
    87  displayed in place of their value.
    88  
    89  ### Limitations of Sensitive Outputs
    90  
    91  * The values of sensitive outputs are still stored in the Terraform
    92    state, and available using the `terraform output` command, so cannot be
    93    relied on as a sole means of protecting values.
    94  * Sensitivity is not tracked internally, so if the output is interpolated in
    95    another module into a resource, the value will be displayed.