Outputs

View saved

Declare an output

Save as outputs.tf:

output "hello_path" {
  description = "Where the greeting file was written"
  value       = local_file.hello.filename
}

Read outputs

After a successful apply:

terraform output
terraform output -raw hello_path

Why outputs matter

They surface IDs, URLs, and paths without digging through state by hand—especially when modules stack together.

Sensitive outputs

Mark outputs sensitive when they contain secrets so Terraform redacts them in logs.

output "api_token" {
  value     = var.api_token
  sensitive = true
}

Comments

One comment per signed-in account. Comments are saved with this page’s URL.