To reproduce using Terraform 0.11.7:
define any resource (but don't create it), then run terraform plan -detailed-exitcode -destroy
I would expect the -destroy flag to switch the context, such that -detailed-exitcode reports back what's there to destroy - not create, but it returns a 2.
Returning codes that indicate what's there to destroy (rather than create) allows my jenkins pipeline to know if it was successful at planing a destroy. Based on the current error codes, if it gets back a "2", then it thinks there's something to destroy (when there isn't). Conversely, if there were no changes (to create), this incorrectly indicates that there's nothing to destroy when there definitely can be.
It's important to plan a destroy, so I don't want to skip that step, but I will for now work around this by ignoring the return code unless it's a 1 indicating error. Would be nice though if exit codes were context-specific in terms of either creation or destruction. BTW thanks for the great tool!
To reproduce using Terraform 0.11.7:
define any resource (but don't create it), then run
terraform plan -detailed-exitcode -destroyI would expect the
-destroyflag to switch the context, such that-detailed-exitcodereports back what's there to destroy - not create, but it returns a 2.Returning codes that indicate what's there to destroy (rather than create) allows my jenkins pipeline to know if it was successful at planing a destroy. Based on the current error codes, if it gets back a "2", then it thinks there's something to destroy (when there isn't). Conversely, if there were no changes (to create), this incorrectly indicates that there's nothing to destroy when there definitely can be.
It's important to plan a destroy, so I don't want to skip that step, but I will for now work around this by ignoring the return code unless it's a 1 indicating error. Would be nice though if exit codes were context-specific in terms of either creation or destruction. BTW thanks for the great tool!