
Answer-first summary for fast verification
Answer: Set Terraform deletion_protection to true.
To prevent the database from being dropped when the environment is torn down and recreated, the best approach is to set Terraform's deletion_protection to true. This setting prevents the Cloud SQL instance from being deleted when Terraform destroys the environment, thus preserving the database. Rerunning terraform apply (B) would not prevent the database from being dropped in future teardowns. Creating a read replica (C) or using point-in-time-recovery (PITR) (D) are methods for data recovery or high availability, not for preventing deletion during environment teardown.
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
How can you ensure the Cloud SQL database persists when your DevOps team uses Terraform to tear down and recreate the environment after each application deployment?
A
Set Terraform deletion_protection to true.
B
Rerun terraform apply.
C
Create a read replica.
D
Use point-in-time-recovery (PITR) to recover the database.
No comments yet.