Interview Prep/Terraform/Refactoring, Migration and Drift

How do you safely remove a protected resource in production?

AdvancedProductionRefactoring, Migration and Drift
Answer

In sequence: first apply a change that turns off protection (deletion_protection = false, remove prevent_destroy) as its own PR, confirm it applied, then remove the resource in a second PR with a plan showing only that deletion, and have a snapshot or backup taken beforehand. Mixing protection removal and deletion in one PR hides the intent.

All Terraform questions Roadmap: Terraform in production

More on Refactoring, Migration and Drift