mirror of
https://github.com/letic/terraform-provider-google.git
synced 2024-07-01 15:52:39 +00:00
Add better error message for sql 409 (#3414)
Signed-off-by: Modular Magician <magic-modules@google.com>
This commit is contained in:
parent
55ef37fe38
commit
53cc7fe1ee
|
@ -492,6 +492,9 @@ func resourceSqlDatabaseInstanceCreate(d *schema.ResourceData, meta interface{})
|
|||
|
||||
op, err := config.clientSqlAdmin.Instances.Insert(project, instance).Do()
|
||||
if err != nil {
|
||||
if gerr, ok := err.(*googleapi.Error); ok && gerr.Code == 409 {
|
||||
return fmt.Errorf("Error, failed to create instance %s with error code 409: %s. This may be due to a name collision - SQL instance names cannot be reused within a week.", instance.Name, err)
|
||||
}
|
||||
return fmt.Errorf("Error, failed to create instance %s: %s", instance.Name, err)
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,6 @@ import (
|
|||
"github.com/hashicorp/terraform/helper/acctest"
|
||||
"github.com/hashicorp/terraform/helper/resource"
|
||||
"github.com/hashicorp/terraform/terraform"
|
||||
|
||||
sqladmin "google.golang.org/api/sqladmin/v1beta4"
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user