1. Output declaration
An output block exposes a named value after apply, usable by callers and other configurations.
output "bucket_arn" {Typorithm · medium
Step 1 of 8 · intro card
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>.
output "name" { value = ... } publishes a value.
value can be any expression or reference.
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"
}Connect each part of the code to the concept before you type.
An output block exposes a named value after apply, usable by callers and other configurations.
output "bucket_arn" {value is the expression whose result the output publishes — here the bucket's ARN.
value = aws_s3_bucket.this.arndescription documents what the output is, shown in tooling and docs.
description = "ARN of the created bucket"Read the concept map and follow the code breakdown.
Type the implementation, repair mistakes and work through every recall exercise.
Use the final check without hints; revisit weak concepts in short practice sessions.