I am attempting to shut down an ec2 instance with a dynamic resource dependency. The dynamic resource implementation is buggy, so destroy()
always returns an error code and aborts the shutdown.
I have fixed the destroy()
implementation, but I am unable to deploy the new provider instance because the old implementation keeps on getting used. What options are available in this case? Do I need to manually shut down the instance myself in order to deploy a new instance?
destroy
runs the code which was defined at the time of the resource creation.
One option is to remove the buggy dynamic resource from your stack file manually.
Use pulumi state delete
or a sequence of (1) pulumi stack export
(2) edit the state file to exclude the resource (3) pulumi stack import
.
After this is done, the next pulumi up
should create a new instance of the resource and the next destroy
will run the updated code.