Typorithm · medium

Outputs

terraform-outputsterraformoutputvaluemodule
Saved on this device
Full lesson · 8 learning steps Open any exercise for focused practice
1

Step 1 of 8 · intro card

Learn Outputs

0%

HCL Basics

An output block publishes a named value (its value expression) after apply, exposing it on the CLI and to parent modules that consume the child module.

Outputs are how a Terraform configuration returns information — like a resource's ARN or IP — after an apply completes.

The required value argument is any expression, commonly a reference such as aws_s3_bucket.this.arn, and an optional description documents it.

When a configuration is used as a child module, its outputs become the module's return values, read by the parent as module.<name>.<output>.

01

output "name" { value = ... } publishes a value.

02

value can be any expression or reference.

03

Parents read child outputs as module.<name>.<output>.

resource "aws_s3_bucket" "this" {
  bucket = "my-bucket"
}

output "bucket_arn" {
  value       = aws_s3_bucket.this.arn
  description = "ARN of the created bucket"
}

Read the implementation

Connect each part of the code to the concept before you type.

1. Output declaration

An output block exposes a named value after apply, usable by callers and other configurations.

output "bucket_arn" {

2. Exposed value

value is the expression whose result the output publishes — here the bucket's ARN.

value       = aws_s3_bucket.this.arn

3. Output description

description documents what the output is, shown in tooling and docs.

description = "ARN of the created bucket"

A complete learning loop

01

Understand

Read the concept map and follow the code breakdown.

02

Reconstruct

Type the implementation, repair mistakes and work through every recall exercise.

03

Verify

Use the final check without hints; revisit weak concepts in short practice sessions.

Outputs: Lesson & Practice · Typorithm | ApplyDjinn