https://pulumi.com logo
#google-cloud
Title
# google-cloud
g

glamorous-jelly-86558

09/19/2023, 12:11 AM
Cannot destroy GCP Cloud SQL via
pulumi destroy
Copy code
➜  ~/code/infra/pulumi/app git:(feat/pulumi-playground) ✗ pulumi state unprotect "urn:pulumi:staging::my-sample::gcp:sql/databaseInstance:DatabaseInstance::pulumi-postgres" 
 warning: This command will edit your stack's state directly. Confirm? Yes
Resource unprotected
➜  ~/code/infra/pulumi/app git:(feat/pulumi-playground) ✗ pulumi destroy --target "urn:pulumi:staging::eluve-sample::gcp:sql/databaseInstance:DatabaseInstance::pulumi-postgres"
Copy code
Diagnostics:
  gcp:sql:DatabaseInstance (pulumi-postgres):
    error: deleting urn:pulumi:staging::my-sample::gcp:sql/databaseInstance:DatabaseInstance::pulumi-postgres: 1 error occurred:
        * Error, failed to delete instance because deletion_protection is set to true. Set it to false to proceed with instance deletion
if I run it through the gcloud CLI, it works just fine
Copy code
$ gcloud sql instances delete pulumi-postgres-c407e1e
I figured it out. There are 3 settings to prevent deletion on CloudSQL. More details here: https://github.com/pulumi/pulumi-gcp/issues/1209#issuecomment-1725147154