Mark google_sql_database.{charset,collation} as computed instead of having defaults (#229)

* Mark google_sql_database.{charset,collation} as computed instead of having defaults.

This change is required to avoid the following scenario:
When upgrading from a previous version of the Google provider, TF will change
the charset/collation of existing (TF-managed) databases to utf8/utf8_general_ci
(if the user hasn't added different config values before running TF apply),
potentially overriding any non-default settings that the user my have applied
through the Cloud SQL admin API. This violates POLA.

* Remove charset/collation defaults from the documentation, too.

* Add links to MySQL's and PostgreSQL's documentation about supported charset and collation values.

* Use version 5.7's docs instead of 5.6, since that's the most up to date version of MySQL that we support.

* Add a note that only UTF8 / en_US.UTF8 are currently supported for Cloud SQL PostgreSQL databases.
This commit is contained in:
Stefan Schmidt 2017-08-08 23:32:16 +02:00 committed by Riley Karson
parent 4758ef6350
commit caeb43e39a
2 changed files with 18 additions and 5 deletions

View File

@ -46,13 +46,13 @@ func resourceSqlDatabase() *schema.Resource {
"charset": &schema.Schema{
Type: schema.TypeString,
Optional: true,
Default: "utf8",
Computed: true,
},
"collation": &schema.Schema{
Type: schema.TypeString,
Optional: true,
Default: "utf8_general_ci",
Computed: true,
},
},
}

View File

@ -44,10 +44,23 @@ The following arguments are supported:
* `project` - (Optional) The project in which the resource belongs. If it
is not provided, the provider project is used.
* `charset` - (Optional) The MySQL charset value (default "utf8").
* `charset` - (Optional) The charset value. See MySQL's [Supported Character
Sets and
Collations](https://dev.mysql.com/doc/refman/5.7/en/charset-charsets.html)
and PostgreSQL's [Character Set
Support](https://www.postgresql.org/docs/9.6/static/multibyte.html)
for more details and supported values. Note that Cloud SQL's beta
offering for PostgreSQL databases currently only supports the charset value
`UTF8`.
* `collation` - (Optional) The MySQL collation value (default
"utf8_general_ci").
* `collation` - (Optional) The collation value. See MySQL's [Supported Character
Sets and
Collations](https://dev.mysql.com/doc/refman/5.7/en/charset-charsets.html)
and PostgreSQL's [Collation
Support](https://www.postgresql.org/docs/9.6/static/collation.html) for
more details and supported values. Note that Cloud SQL's beta
offering for PostgreSQL databases currently only supports the collation
value `en_US.UTF8`.
## Attributes Reference