Search⌘ K
AI Features

Terraform Module Outputs

Explore how to create and use outputs in Terraform modules to expose important data such as server IPs or database endpoints. Understand the role of data sources in modules and how outputs dynamically reflect changes in underlying resources, enabling better resource referencing and infrastructure management.

Why outputs matter

Terraform modules often create things we’ll need to reference later, such as a server’s IP address, a database endpoint, or a VPC ID.
Outputs are like a module's “report card”: once the module finishes its work, it gives you important values you can use elsewhere.

Step 1: Create a new module

Let’s make a simple module called ltthw_output that reads a local file and outputs its content.

  1. Create a new folder:

mkdir ltthw_output
cd ltthw_output
...