HiveBrain v1.2.0
Get Started
← Back to all entries
patternterraformMajor

Terraform apply output only

Submitted by: @import:stackexchange-devops··
0
Viewed 0 times
applyonlyoutputterraform

Problem

I'm trying to apply only the output variable definition. Here is the "output" I want to apply.

output "environment_information" {
   value = {
      foo = "value1"
      bar = "value2"
   }
}


Altough I added the "bar" as a new variable, I cannot see anything when I applied it by using the following Terraform command:

terraform apply -target=output.environment_information


Any idea? Is it possible to apply output without any resource/module definition? Thank you.

Solution

Running terraform apply -refresh-only should take care of any new outputs. It will read the latest data from each resource and then update all of the outputs in terms of those updates, which includes re-evaluating your output expressions to incorporate any changes.

Context

StackExchange DevOps Q#14286, answer score: 24

Revisions (0)

No revisions yet.