Revert resource marked for deletion

110 views
Skip to first unread message

Calin Florescu

unread,
Sep 14, 2023, 9:51:44 AM9/14/23
to crossplane-dev
Hey there,

I have been using Crossplane for almost a year on the project I am working on, and I encountered an interesting use case that I don't find being documented anywhere, so I thought I might ask for some expertise here :D

I am using GCP as an Infrastructure provider and Crossplane to allow developers to spawn their S3 Buckets (Cloud Storage) or Databases (Postgre Instances).

In the beginning, I was using this provider since, I think, there was the only one around. In the meantime, I migrated to the Upbound managed provider for GCP, where resource APIs changed for SQL Instances from CloudSqlInstance to DatabaseInstance.

During the migration, there was a time when I had in my cluster both CloudSqlInstance and DatabaseInstance objects managing my external db created in GCP. When I decided to delete the CloudSqlInstance one, the external resource was marked for deletion. I was unaware that it was the DeletionPolicy set. 

Now I have my external db managed by the DatabaseInstance object, but I can't make any updates on it because, being marked for deletion, I get this error message: 
observe failed: cannot run plan: plan failed: Instance cannot be destroyed: Resource google_sql_database_instance.db_name has lifecycle.prevent_destroy set,  │
│ but the plan calls for this resource to be destroyed. To avoid this error and continue with the plan, either disable lifecycle.prevent_destroy or reduce the scope of the plan using the -target flag.

I was curious if anyone had experienced something like this and if they knew how to revert that signal and re-sync my resource with the external DB.

Sorry for the long message, but I wanted to be as clear as possible.

Thanks, and have a great day!
Reply all
Reply to author
Forward
0 new messages