So I have an application that runs terraform apply
in a directory, then can also run terraform destroy
. I was testing the application, and I accidentally interrupted the processes while running apply
Now it seems to be stuck with a partially created instance, where it recognizes the name of my instance I was creating/destroying and when I try to apply
it says that an instance of that name already exists. But then destroy
says there is nothing to destroy. So I can't do either. Is there anyway to unsnarl this?
you can run the below to view all current resources still live from the project directory:
$ terraform state list
to destroy each resource run the below on each individual resource:
$ terraform destroy --target=resource.name
could write a script to loop through the 'terraform state list' output if there is a lot.
I'm afraid that the only option is by doing:
execute terraform state rm RESOURCE
example: terraform state rm aws_ebs_volume.volume
.
Manually remove the resource from your cloud provider.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With