Interview Prep/Terraform/Lifecycle, Dependencies, Provisioners and Drift

What does `prevent_destroy` guarantee and what does it not?

AdvancedConceptLifecycle, Dependencies, Provisioners and Drift
Answer

It makes any plan that would destroy that resource fail with Instance cannot be destroyed. It is a guard-rail for databases and state buckets. It does not stop someone deleting the whole resource block (then Terraform has no lifecycle to read), running state rm, or deleting the object outside Terraform.

All Terraform questions Roadmap: Terraform in production

More on Lifecycle, Dependencies, Provisioners and Drift