Allow use of provider region, with big caveats in docs. (#1463)

This commit is contained in:
Nathan McKinley 2018-05-09 14:16:49 -07:00 committed by GitHub
parent 105709bbdb
commit 560e180693
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 2 deletions

View File

@ -51,7 +51,7 @@ func resourceSqlDatabaseInstance() *schema.Resource {
Schema: map[string]*schema.Schema{
"region": &schema.Schema{
Type: schema.TypeString,
Required: true,
Optional: true,
ForceNew: true,
},
@ -423,7 +423,10 @@ func resourceSqlDatabaseInstanceCreate(d *schema.ResourceData, meta interface{})
return err
}
region := d.Get("region").(string)
region, err := getRegion(d, config)
if err != nil {
return err
}
databaseVersion := d.Get("database_version").(string)
_settingsList := d.Get("settings").([]interface{})

View File

@ -59,6 +59,10 @@ The following arguments are supported:
* `region` - (Required) The region the instance will sit in. Note, first-generation Cloud SQL instance
regions do not line up with the Google Compute Engine (GCE) regions, and Cloud SQL is not
available in all regions - choose from one of the options listed [here](https://cloud.google.com/sql/docs/mysql/instance-locations).
A valid region must be provided to use this resource. If a region is not provided in the resource definition,
the provider region will be used instead, but this will be an apply-time error for all first-generation
instances *and* for second-generation instances if the provider region is not supported with Cloud SQL.
If you choose not to provide the `region` argument for this resource, make sure you understand this.
* `settings` - (Required) The settings to use for the database. The
configuration is detailed below.