diff --git a/.changelog/5121.txt b/.changelog/5121.txt new file mode 100644 index 0000000000..fce11059f1 --- /dev/null +++ b/.changelog/5121.txt @@ -0,0 +1,3 @@ +```release-note:enhancement +sql: added field `collation` to `google_sql_database_instance` +``` diff --git a/google-beta/resource_gke_hub_feature_membership_test.go b/google-beta/resource_gke_hub_feature_membership_test.go index 9e1f2ea64d..32fa84c196 100644 --- a/google-beta/resource_gke_hub_feature_membership_test.go +++ b/google-beta/resource_gke_hub_feature_membership_test.go @@ -5,7 +5,7 @@ import ( "fmt" "testing" - "github.com/GoogleCloudPlatform/declarative-resource-client-library/dcl" + dcl "github.com/GoogleCloudPlatform/declarative-resource-client-library/dcl" gkehub "github.com/GoogleCloudPlatform/declarative-resource-client-library/services/google/gkehub/beta" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" diff --git a/google-beta/resource_sql_database_instance.go b/google-beta/resource_sql_database_instance.go index ca0bb6ae82..aa6cd8f109 100644 --- a/google-beta/resource_sql_database_instance.go +++ b/google-beta/resource_sql_database_instance.go @@ -238,6 +238,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, @@ -991,6 +996,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), @@ -1396,6 +1402,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/google-beta/resource_sql_database_instance_test.go b/google-beta/resource_sql_database_instance_test.go index 58c0868854..187fc55b70 100644 --- a/google-beta/resource_sql_database_instance_test.go +++ b/google-beta/resource_sql_database_instance_test.go @@ -958,6 +958,7 @@ resource "google_sql_database_instance" "instance" { deletion_protection = false settings { tier = "db-custom-1-3840" + collation = "Polish_CI_AS" } } ` diff --git a/website/docs/d/sql_database_instance.html.markdown b/website/docs/d/sql_database_instance.html.markdown index d274141553..2ebbd09531 100644 --- a/website/docs/d/sql_database_instance.html.markdown +++ b/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/website/docs/r/sql_database_instance.html.markdown b/website/docs/r/sql_database_instance.html.markdown index 806a9967aa..affb79aceb 100644 --- a/website/docs/r/sql_database_instance.html.markdown +++ b/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.