output value
A named value a configuration publishes after apply, declared in an output block, like the return value of a function.
In more detail
Outputs serve people reading the apply summary, scripts that need a value afterwards, and callers of a module, which can see nothing else inside it. Give every output a description, because for a module the outputs are its published interface. Outputs are stored in state, so terraform output can read them at any time.
Example
output "manifest_path" {
description = "File this configuration wrote."
value = local_file.manifest.filename
}Related terms
- terraform output — The command that prints output values from state; -raw prints one bare value for a shell variable and -json prints machine-readable output for programs.
- module interface — The variables a module accepts and the outputs it publishes, which together are everything a caller may rely on.
- sensitive value — A variable or output marked sensitive = true, which Terraform hides in plan output and the terminal but still stores in state in plain text.
- remote state — Reading another configuration's output values from its state, using the terraform_remote_state data source.
Taught in
- Return Values: Outputs And Locals — Infrastructure as Code with Terraform
- Functions And Expressions In HCL — Infrastructure as Code with Terraform
- Querying Existing Infrastructure With Data Sources — Infrastructure as Code with Terraform
- Why Modules: Composition Versus Monoliths — Infrastructure as Code with Terraform
- Writing A Custom Network Module — Infrastructure as Code with Terraform
- Calling Your Module And Passing Variables — Infrastructure as Code with Terraform
- What State Really Is And Why It Is Needed — Infrastructure as Code with Terraform
- State: Terraform's Memory Of What It Built — HashiCorp Terraform Associate (004) Exam Prep
- Write, Plan, Apply, And What Init Prepares — HashiCorp Terraform Associate (004) Exam Prep
- Reading A Plan, Saving It, Applying It — HashiCorp Terraform Associate (004) Exam Prep
- Resources, Data Sources And The References Between Them — HashiCorp Terraform Associate (004) Exam Prep
- Input Variables, Outputs, And Which Value Wins — HashiCorp Terraform Associate (004) Exam Prep
- Complex Types: Lists, Sets, Maps, Objects And Tuples — HashiCorp Terraform Associate (004) Exam Prep
- Expressions And Functions: Making Configuration Compute — HashiCorp Terraform Associate (004) Exam Prep
- Count, For Each And Dynamic Blocks — HashiCorp Terraform Associate (004) Exam Prep