Terraform doesn’t have a way to directly compare one plan with another plan; that would be a diff of a diff, rather than just a diff of direct changes.
However, you could perhaps “fake it” by viewing the saved plan and then running a fresh
terraform plan and see what’s different between them:
terraform show -no-color somename >old.txt
terraform plan -no-color >new.txt
diff -u old.txt new.txt
With that said, a plan being “stale” is defined in a pretty low-level way, by checking if the latest state snapshot is identical to the one saved in the plan file. That means that this can happen even if there aren’t any “meaningful” changes, if e.g. someone ran an operation that only modified the state, like
terraform import or
terraform state rm.
You could potentially get a lower-level look at that by digging into the implementation weeds a bit, but this is just a current implementation detail and so might change in future Terraform versions:
somename.zip, because a saved plan is currently a Zip archive.
somename.zip in your favorite archive manager and extract the state snapshot file inside it.
terraform state pull to fetch the current state snapshot.
- Compare those two snapshots.
That is, in effect, what Terraform itself is doing in order to produce that error message.