From f2c8613fcee49c2e26979b6a9db44b0268e8ca6f Mon Sep 17 00:00:00 2001 From: Shuya Ma <87669292+shuyama1@users.noreply.github.com> Date: Mon, 23 Aug 2021 14:43:30 -0700 Subject: [PATCH] Add collation to google_sql_database_instance (#5121) * add collation field to google_sql_database_instance * update datasource documentation * remove default value * add test --- .../resources/resource_sql_database_instance.go.erb | 7 +++++++ .../tests/resource_sql_database_instance_test.go.erb | 1 + .../website/docs/d/sql_database_instance.html.markdown | 2 ++ .../website/docs/r/sql_database_instance.html.markdown | 2 ++ 4 files changed, 12 insertions(+) diff --git a/mmv1/third_party/terraform/resources/resource_sql_database_instance.go.erb b/mmv1/third_party/terraform/resources/resource_sql_database_instance.go.erb index e5acb3894836..96ff57397d4b 100644 --- a/mmv1/third_party/terraform/resources/resource_sql_database_instance.go.erb +++ b/mmv1/third_party/terraform/resources/resource_sql_database_instance.go.erb @@ -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, @@ -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), @@ -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, diff --git a/mmv1/third_party/terraform/tests/resource_sql_database_instance_test.go.erb b/mmv1/third_party/terraform/tests/resource_sql_database_instance_test.go.erb index 6da8bf7545f5..c27b359bab71 100644 --- a/mmv1/third_party/terraform/tests/resource_sql_database_instance_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_sql_database_instance_test.go.erb @@ -960,6 +960,7 @@ resource "google_sql_database_instance" "instance" { deletion_protection = false settings { tier = "db-custom-1-3840" + collation = "Polish_CI_AS" } } ` diff --git a/mmv1/third_party/terraform/website/docs/d/sql_database_instance.html.markdown b/mmv1/third_party/terraform/website/docs/d/sql_database_instance.html.markdown index d27414155359..2ebbd09531a1 100644 --- a/mmv1/third_party/terraform/website/docs/d/sql_database_instance.html.markdown +++ b/mmv1/third_party/terraform/website/docs/d/sql_database_instance.html.markdown @@ -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) diff --git a/mmv1/third_party/terraform/website/docs/r/sql_database_instance.html.markdown b/mmv1/third_party/terraform/website/docs/r/sql_database_instance.html.markdown index 806a9967aa90..affb79acebaa 100644 --- a/mmv1/third_party/terraform/website/docs/r/sql_database_instance.html.markdown +++ b/mmv1/third_party/terraform/website/docs/r/sql_database_instance.html.markdown @@ -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.