I'm using gcloud sql instances create to create CloudSQL instances. More often than not, that command times out, but provides a command to wait until databse creation is done.
$ gcloud sql instances create mydb
Creating Cloud SQL instance...failed.
ERROR: (gcloud.sql.instances.create) Operation https://www.googleapis.com/sql/v1beta4/projects/foobar/operations/abcd is taking longer than expected.
You can continue waiting for the operation by running `gcloud sql operations wait --project foobar abcd`
$ gcloud sql operations wait --project foobar abcd
Waiting for [https://www.googleapis.com/sql/v1beta4/projects/foobar/operations/abcd]...done.
NAME TYPE START END ERROR STATUS
abcd CREATE 2018-03-19T15:04:29.477+00:00 2018-03-19T15:10:08.561+00:00 - DONE
I wonder if it's possible to configure the timeout for gcloud sql instances create? I can't seem to find anything in the docs, not even the timeout it's using by default.
Another option would be to start instance creation asynchronously, list the pending operations and wait for their completion:
$ gcloud sql instances create mydb --async
$ PENDING_OPERATIONS=$(gcloud sql operations list --instance=mydb --filter='status!=DONE' --format='value(name)')
$ gcloud sql operations wait "${PENDING_OPERATIONS}"
But then again, would gcloud sql operations wait timeout at some point? The docs don't mention any timeout either.