github.com/vtorhonen/terraform@v0.9.0-beta2.0.20170307220345-5d894e4ffda7/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    * `depends_on` (list of strings) - Explicit dependencies that this
    62        output has. These dependencies will be created before this
    63        output value is processed. The dependencies are in the format of
    64        `TYPE.NAME`, for example `aws_instance.web`.
    65  
    66    * `sensitive` (optional, boolean) - See below.
    67  
    68  ## Syntax
    69  
    70  The full syntax is:
    71  
    72  ```ruby
    73  output NAME {
    74    value = VALUE
    75  }
    76  ```
    77  
    78  ## Sensitive Outputs
    79  
    80  Outputs can be marked as containing sensitive material by setting the
    81  `sensitive` attribute to `true`, like this:
    82  
    83  ```ruby
    84  output "sensitive" {
    85    sensitive = true
    86    value     = VALUE
    87  }
    88  ```
    89  
    90  When outputs are displayed on-screen following a `terraform apply` or
    91  `terraform refresh`, sensitive outputs are redacted, with `<sensitive>`
    92  displayed in place of their value.
    93  
    94  ### Limitations of Sensitive Outputs
    95  
    96  * The values of sensitive outputs are still stored in the Terraform
    97    state, and available using the `terraform output` command, so cannot be
    98    relied on as a sole means of protecting values.
    99  * Sensitivity is not tracked internally, so if the output is interpolated in
   100    another module into a resource, the value will be displayed.