Steven Cole
Steven Cole

Reputation: 21

"gcloud sql instances create" aborts when given options

When I run gcloud sql instances create testdb1, I make a database. When I run gcloud sql instances create testdb2 --pricing-plan=PER_USE, I get a python stack trace:

DEBUG: operation : None
DEBUG: (gcloud.sql.instances.create) The instance or operation is not in an appropriate state to handle the request.
Traceback (most recent call last):
  File "/home/scole/google-cloud-sdk/./lib/googlecloudsdk/calliope/cli.py", line 548, in Execute
    result = args.cmd_func(cli=self, args=args)
  File "/home/scole/google-cloud-sdk/./lib/googlecloudsdk/calliope/backend.py", line 1124, in Run
    result = command_instance.Run(args)
  File "/home/scole/google-cloud-sdk/./lib/googlecloudsdk/sql/util.py", line 229, in Func
    return foo(*args, **kwargs)
  File "/home/scole/google-cloud-sdk/lib/googlecloudsdk/sql/tools/instances/create.py", line 206, in Run
    result = sql_client.instances.Insert(instance_resource)
  File "/home/scole/google-cloud-sdk/./lib/googlecloudapis/sqladmin/v1beta3/sqladmin_v1beta3_client.py", line 401, in Insert
    config, request, global_params=global_params)
  File "/home/scole/google-cloud-sdk/./lib/googlecloudapis/apitools/base/py/base_api.py", line 639, in _RunMethod
    return self.ProcessHttpResponse(method_config, http_response)
  File "/home/scole/google-cloud-sdk/./lib/googlecloudapis/apitools/base/py/base_api.py", line 645, in ProcessHttpResponse
    self.__ProcessHttpResponse(method_config, http_response))
  File "/home/scole/google-cloud-sdk/./lib/googlecloudapis/apitools/base/py/base_api.py", line 528, in __ProcessHttpResponse
    raise exceptions.HttpError.FromResponse(http_response)
HttpException: The instance or operation is not in an appropriate state to handle the request.
ERROR: (gcloud.sql.instances.create) The instance or operation is not in an appropriate state to handle the request.

That trace happens any time I add an option to the command line. Where should I be looking to make command line options work?

According to gcloud --version, I'm on gcloud SDK 0.9.69.

Upvotes: 0

Views: 599

Answers (1)

Steven Cole
Steven Cole

Reputation: 21

I got a response from Google support. It seems this exception is thrown when you try to create an SQL instance using a previously-used name. Adding some kind of uuid to the name will fix the issue.

(So my iterating my deployment code [ create-delete-create-delete-etc ] re-using the same name is the wrong way to handle things.)

Upvotes: 2

Related Questions