FEATURES PRICING ABOUT DOCS LOGIN

Output Configuration

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.

Terraform knows a lot about the infrastructure it manages. Most resources have attributes associated with them, and outputs are a way to easily extract and query that information.

This page assumes you are familiar with the configuration syntax already.

Example

A simple output configuration looks like the following:

output "address" {
  value = "${aws_instance.db.public_dns}"
}

This will output a string value corresponding to the public DNS address of the Terraform-defined AWS instance named “db”. It is possible to export complex data types like maps and strings as well:

output "addresses" {
  value = ["${aws_instance.web.*.public_dns}"]
}

Description

The output block configures a single output variable. Multiple output variables can be configured with multiple output blocks. The NAME given to the output block is the name used to reference the output variable.

Within the block (the { }) is configuration for the output. These are the parameters that can be set:

Syntax

The full syntax is:

output NAME {
  value = VALUE
}

Sensitive Outputs

Outputs can be marked as containing sensitive material by setting the sensitive attribute to true, like this:

output "sensitive" {
  sensitive = true
  value     = VALUE
}

When outputs are displayed on-screen following a terraform apply or terraform refresh, sensitive outputs are redacted, with <sensitive> displayed in place of their value.

Limitations of Sensitive Outputs


See the source of this document at Terraform.io

REQUEST A DEMO