Skip to content

demo: Fix deletion of Praefect Cloud SQL instance

Stan Hu requested to merge sh-fix-demo-deletion into master

Previously attempting to destroy a cluster would result in the following errors:

Error: Error, failed to deleteuser praefect in instance <instance name>
Error: Error, failed to delete instance because deletion_protection
is set to true. Set it to false to proceed with instance deletion

For the deleteuser error, https://github.com/hashicorp/terraform-provider-google/issues/7677 has added the ABANDON flag, which according to https://github.com/GoogleCloudPlatform/magic-modules/pull/4231:

Setting ABANDON allows the resource to be abandoned rather than
deleted. This is useful for Postgres, where users cannot be deleted from
the API if they have been granted SQL roles.

For the delete_protection error, as described in https://stackoverflow.com/a/64911997, recent versions of Terraform sets delete_protection on by default. We need to disable this to be able to destroy this Cloud SQL instance.

Edited by Stan Hu

Merge request reports