Outputs

Objective

Understand the basics of Terraform outputs.

Overview

Outputs return a value from a module. This value can be used in other modules or as user readable outputs.

Lab

In this lab we will create a static text output.

Add a Static Output

Let’s create a basic output in the root module. This output will return a string value. Since it is in the root module and a known value it will be visible in the plan.

edit output.tf

output "text" {
  value = "Hello World"
}

Plan

Execute

terraform plan

Review

In this section we created a static output. We did not apply the change and thus no state has been created. We will cover that in the next section. It’s not currently very useful but will become more useful as we build on our project.

Additional Reading