Hi, “Terraform plan -destroy” is failing when it observes the prevent_destroy flag in config files. Not sure why is it forcing us to use the -target flag
Error message: lifecycle.prevent_destroy set, but the plan calls for this resource to be destroyed. To avoid this error a
│ the plan, either disable lifecycle.prevent_destroy or reduce the scope of the plan using the -target flag.
What I am expecting:
When we plan to destroy or if we execute destroy command, terraform should delete the resources which don’t have the prevent_destroy flag. And it shouldn’t touch the resources with the prevent_destroy flag. But here in my case, it’s failing at the planning stage.
Not sure if this is how the destruction should work? Can anyone give me some clarity on this behaviour of terraform