Skip to content

Commit

Permalink
Mark google_sql_database.{charset,collation} as computed instead of h…
Browse files Browse the repository at this point in the history
…aving defaults (hashicorp#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.
  • Loading branch information
ubschmidt2 authored and rileykarson committed Aug 8, 2017
1 parent 9904d9a commit e207e44
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
4 changes: 2 additions & 2 deletions google/resource_sql_database.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
},
}
Expand Down
21 changes: 17 additions & 4 deletions website/docs/r/sql_database.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -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").

* `collation` - (Optional) The MySQL collation value (default
"utf8_general_ci").
* `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 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

Expand Down

0 comments on commit e207e44

Please sign in to comment.