Skip to content

Commit

Permalink
Add collation to google_sql_database_instance (GoogleCloudPlatform#5121)
Browse files Browse the repository at this point in the history
* add collation field to google_sql_database_instance

* update datasource documentation

* remove default value

* add test
  • Loading branch information
shuyama1 authored and khajduczenia committed Oct 12, 2021
1 parent e80175b commit f2c8613
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,11 @@ settings.backup_configuration.binary_log_enabled are both set to true.`,
},
},
},
"collation": {
Type: schema.TypeString,
Optional: true,
Description: `The name of server instance collation.`,
},
"crash_safe_replication": {
Type: schema.TypeBool,
Optional: true,
Expand Down Expand Up @@ -997,6 +1002,7 @@ func expandSqlDatabaseInstanceSettings(configured []interface{}, secondGen bool)
ForceSendFields: []string{"StorageAutoResize"},
ActivationPolicy: _settings["activation_policy"].(string),
AvailabilityType: _settings["availability_type"].(string),
Collation: _settings["collation"].(string),
CrashSafeReplicationEnabled: _settings["crash_safe_replication"].(bool),
DataDiskSizeGb: int64(_settings["disk_size"].(int)),
DataDiskType: _settings["disk_type"].(string),
Expand Down Expand Up @@ -1404,6 +1410,7 @@ func flattenSettings(settings *sqladmin.Settings) []map[string]interface{} {
"activation_policy": settings.ActivationPolicy,
"authorized_gae_applications": settings.AuthorizedGaeApplications,
"availability_type": settings.AvailabilityType,
"collation": settings.Collation,
"crash_safe_replication": settings.CrashSafeReplicationEnabled,
"disk_type": settings.DataDiskType,
"disk_size": settings.DataDiskSizeGb,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -960,6 +960,7 @@ resource "google_sql_database_instance" "instance" {
deletion_protection = false
settings {
tier = "db-custom-1-3840"
collation = "Polish_CI_AS"
}
}
`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ The `settings` block contains:
* `availability_type` - The availability type of the Cloud SQL
instance, high availability (`REGIONAL`) or single zone (`ZONAL`).

* `collation` - The name of server instance collation.

* `crash_safe_replication` - (Deprecated) This property is only applicable to First Generation instances.
First Generation instances are now deprecated, see [here](https://cloud.google.com/sql/docs/mysql/upgrade-2nd-gen)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,8 @@ instance, high availability (`REGIONAL`) or single zone (`ZONAL`).' For MySQL
instances, ensure that `settings.backup_configuration.enabled` and
`settings.backup_configuration.binary_log_enabled` are both set to `true`.

* `collation` - (Optional) The name of server instance collation.

* `crash_safe_replication` - (Optional, Deprecated) This property is only applicable to First Generation instances.
First Generation instances are now deprecated, see [here](https://cloud.google.com/sql/docs/mysql/upgrade-2nd-gen)
for information on how to upgrade to Second Generation instances.
Expand Down

0 comments on commit f2c8613

Please sign in to comment.