CLOUD-DATABASE-ENGINEER practice question 1 of 25
Your DevOps team is using Terraform to deploy applications and Cloud SQL databases. After every new application change is rolled out, the environment is torn down and recreated, and the persistent database layer is lost. You need to prevent the database from being dropped. What should you do?
Full set: 141 questionsThe core issue is that the terraform destroy command, which is part of the environment teardown process, is deleting the Cloud SQL instance. The deletionprotection argument within the Terraform googlesqldatabaseinstance resource is specifically designed to prevent this. When set to true, any attempt by Terraform to destroy the instance will fail, thus protecting the persistent database layer from being lost during automated environment recreation cycles. This directly addresses the requirement to prevent the database from being dropped.
B. Rerun terraform apply: This command creates or updates resources based on the configuration. It does not prevent a resource from being deleted by a terraform destroy command.
C. Create a read replica: A read replica is for scaling read traffic or for high availability. It does not prevent the primary instance from being deleted by Terraform.
D. Use point-in-time-recovery (PITR) to recover the database: PITR is a reactive measure used to restore a database after it has been deleted or corrupted. The goal is to proactively prevent deletion. ---
1. Terraform Documentation for the Google Provider: The documentation for the googlesqldatabaseinstance resource explicitly lists the deletionprotection argument. It states, "Used to block Terraform from deleting a SQL Instance." This is the direct mechanism to solve the problem described.
Source: Terraform Registry, Google Provider, googlesqldatabaseinstance resource documentation, deletionprotection argument description.
2. Google Cloud SQL Documentation: The underlying feature in Google Cloud that Terraform manages is "Deletion protection." The official documentation explains that this setting protects an instance from accidental deletion. When enabled, you cannot delete the instance until the protection is disabled.
Source: Google Cloud Documentation, Cloud SQL > Documentation > How-to guides > Edit an instance, Section: "Enable and disable deletion protection".
3. Google Cloud SQL Documentation: The instance settings documentation further clarifies the purpose of deletion protection, confirming it's a safeguard for production instances.
Source: Google Cloud Documentation, Cloud SQL > Documentation > Concepts > Instances, Section: "Instance settings".
Keep practicing
Take the free CLOUD-DATABASE-ENGINEER practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other CLOUD-DATABASE-ENGINEER practice questions
- Question 2Your company is developing a new global transactional application that must be ACID-compl…
- Question 3You are designing a database strategy for a new web application. You plan to start with a…
- Question 4Your application uses Cloud SQL for MySQL. Your users run reports on data that relies on …
- Question 5You plan to use Database Migration Service to migrate data from a PostgreSQL on-premises …
- Question 6You host an application in Google Cloud. The application is located in a single region an…
- Question 7You finished migrating an on-premises MySQL database to Cloud SQL. You want to ensure tha…
