Using Google Cloud SQL I was attempting to restore my main instance to a prior backup, but first I wanted to clone the instance for the tables and databases that I didn't want reverted. After waiting over an hour for the clone, I canceled out of the clone and attempted to delete the cloned instance. However, the clone is now stuck in Maintenance status and attempting to delete I get the following error.
mycomputer:~ myuser$ gcloud sql instances delete cloned
All of the instance data will be lost when the instance is deleted.
Do you want to continue (Y/n)? y
ERROR: (gcloud.sql.instances.delete) The instance or operation is not in an appropriate state to handle the request.
The instance was created with the following command and then just exited out with CTRL+C after waiting too long.
mycomputer:~ myuser$ gcloud sql instances clone main cloned
Cloning Cloud SQL instance.../ERROR: Caught socket error, retrying:[Errno 54] Connection reset by peer
ERROR: Caught socket error, retrying: [Errno 54] Connection reset by peer
Cloning Cloud SQL instance...|
Cloning Cloud SQL instance...\^C
Command killed by keyboard interrupt
I tried replicating this problem with the Cloud SQL API Explorer. I found this error message on a different thread initiated on the Google forums. The error message "The instance or operation is not in an appropriate state to handle the request" occurs when the same name for the instance is being used. Now it also made sense to me why, in the official documentation of Terraform, a random_id resource is created as database name suffix.
I was getting this error while creating SQL instance in GCP with terraform
Error: Error, failed to create instance <name>: googleapi: Error 409: The instance or operation is not in an appropriate state to handle the request., invalidState
I was able to solve it by changing the SQL instance name in the conf and it worked like perfectly
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With