In Terraform Enterprise (TFE), a run is separated into a plan phase and an apply phase. The option to perform an apply as part of a run is only presented if TFE detects that the Terraform plan would change deployed infrastructure. When there are changes to Terraform outputs but no infrastructure changes, the option to perform an apply to update the outputs is not offered.
This is a known issue, and is planned to be fixed in a future version of Terraform. (See the CHANGELOG to determine whether this may have been occurred already). In the meantime, there are two workarounds for this issue.
Recommended approach: null resource
Add a small and insignificant infrastructure change to make the apply option available. For example, add an unused, empty null_resource
to the configuration.
resource "null_resource" "n" {}
Then, perform a run in TFE, and the plan phase will detect the need to change the null resource, so the option to apply will be offered. The apply phase will then also update the output.
The null_resource
can then be removed, or it can remain in case another output-only update needs to be performed, and be removed at that time to trigger another change.
Alternative: use TFE backend
A more involved option is to use the TFE backend for the workspace and run the apply locally. If the backend has not already been configured, see Using Terraform Locally with a Terraform Enterprise Backend.
Once the backend is configured, set the local variables to the same values as those in TFE, then use terraform apply
at the command line to update the output.
This can be very complex to achieve if, for example, there are many variables set in TFE that are not available at the command line. Missing variables, or variables with different values, will result in a different plan that could perform undesirable changes. For this reason, we recommend the null resource approach.