github.com/jzbruno/terraform@v0.10.3-0.20180104230435-18975d727047/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.
    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, or
    58    map. This usually includes an interpolation since outputs that are static
    59    aren't usually useful.
    60  
    61  - `description` (optional) - A human-friendly description for the output. This
    62    is primarily for documentation for users using your Terraform configuration. A
    63    future version of Terraform will expose these descriptions as part of some
    64    Terraform CLI command.
    65  
    66  - `depends_on` (list of strings) - Explicit dependencies that this output has.
    67    These dependencies will be created before this output value is processed. The
    68    dependencies are in the format of `TYPE.NAME`, for example `aws_instance.web`.
    69  
    70  - `sensitive` (optional, boolean) - See below.
    71  
    72  ## Syntax
    73  
    74  The full syntax is:
    75  
    76  ```text
    77  output NAME {
    78    value = VALUE
    79  }
    80  ```
    81  
    82  ## Sensitive Outputs
    83  
    84  Outputs can be marked as containing sensitive material by setting the
    85  `sensitive` attribute to `true`, like this:
    86  
    87  ```hcl
    88  output "sensitive" {
    89    sensitive = true
    90    value     = VALUE
    91  }
    92  ```
    93  
    94  When outputs are displayed on-screen following a `terraform apply` or
    95  `terraform refresh`, sensitive outputs are redacted, with `<sensitive>`
    96  displayed in place of their value.
    97  
    98  ### Limitations of Sensitive Outputs
    99  
   100  - The values of sensitive outputs are still stored in the Terraform state, and
   101    available using the `terraform output` command, so cannot be relied on as a
   102    sole means of protecting values.
   103  
   104  - Sensitivity is not tracked internally, so if the output is interpolated in
   105    another module into a resource, the value will be displayed.