After cleanly running terraform apply, I expect terraform plan to output No changes. Infrastructure is up-to-date., but instead terraform acts as if there are changes, but does not actually show any in the plan:
An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
Terraform will perform the following actions:
Plan: 0 to add, 0 to change, 0 to destroy.
Changes to Outputs:
------------------------------------------------------------------------
Note: You didn't specify an "-out" parameter to save this plan, so Terraform
can't guarantee that exactly these actions will be performed if
"terraform apply" is subsequently run.
Exited with code exit status 2
How can I troubleshoot what is causing Terraform to generate the empty plan and resolve the issue? (this is on version 0.14.5)
Based on that dangling “Changes to outputs:” I have a theory that something has changed about your outputs but in a way that Terraform 0.14 isn’t rendering correctly.
I remember a report of a bug (now fixed for forthcoming 0.15, I believe) where something like what you saw here happens when there’s a new output block in the root module whose initial value is null. Because in v0.14 Terraform was reusing the same diff printer it uses for resource bodies, it was inheriting the rule that null values represent not present at all, which doesn’t quite apply to outputs: an output can both exist and have the value null at the same time.
Have you recently added any output blocks to your root module?
Thanks for the response @apparentlymart. I reviewed the changelog and no output blocks have been removed. Looking at the CI history, it looks like this was introduced during an upgrade from 0.13.5 to 0.14.4. The only other change that snuck in at the same time was a change to a count on a resource (both non-zero).