Open crandall-chow-bl opened 2 years ago
What happens if you run terraform destroy
instead of commenting the module out?
Will try that and reply but that's certainly not what I want to do. Commenting it out is just the test to show how the "destroy" can be called.
The actual use case is to pass a release number in the create_cmd_body
. When I want to deploy a new version, I update the module stanza with the new version number. Calling terraform apply
will see the change to the module, and have it do a "replace" (invoking my previous destroy_cmd_entrypoint
and destroy_cmd_body
saved in the .tfstate
, then invoking the new create_cmd_entrypoint
and body
).
Also, notice in the debug output, some "destroy" is indeed being triggered, but my configured entrypoint/body are not called.
Will try that and reply but that's certainly not what I want to do. Commenting it out is just the test to show how the "destroy" can be called.
Yeah, I'm mostly trying to figure out why it wouldn't be invoked in your environment.
I attempted the terraform destroy
and sure enough, doing THAT does indeed invoke the entrypoint and body (see gist below). So it's just the destroy on a normal apply
path (e.g. delete the resource, or modify the resource causing a delete/create replace) where the endpoint/body aren't being invoked.
https://gist.github.com/crandall-chow-bl/b5a427c276f6c2c6be0d402304affe53#file-destroy-txt
This is on macOS 12.2.1 in case that matters.
Unfortunately it looks like this is a Terraform Core issue: https://github.com/hashicorp/terraform/issues/13549
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days
TL;DR
The configured
destroy_cmd_entrypoint
anddestroy_cmd_body
are not being invoked, even though the logs show the destroy was triggered and resource was removed from the.tfstate
.Expected behavior
On "destroy" (such as when TF needs to do a replace) the configured
destroy_cmd_entrypoint
anddestroy_cmd_body
should be invoked, similar to what happens on create, where thecreate_cmd_entrypoint
andcreate_cmd_body
are clearly invoked.Observed behavior
Creates are doing as expected, calling the configured entrypoint, but destroys are not. The
.tfstate
data is indeed created and destroyed as expected, but the custom entrypoints are never getting invoked.Terraform Configuration
Terraform Version
Debug Output
https://gist.github.com/crandall-chow-bl/b5a427c276f6c2c6be0d402304affe53
Additional information
Steps to Reproduce