Skip to content

Commit 73ae281

Browse files
Add collation to google_sql_database_instance (#5121) (#3557)
* add collation field to google_sql_database_instance * update datasource documentation * remove default value * add test Signed-off-by: Modular Magician <[email protected]>
1 parent 3726be4 commit 73ae281

File tree

6 files changed

+16
-1
lines changed

6 files changed

+16
-1
lines changed

.changelog/5121.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:enhancement
2+
sql: added field `collation` to `google_sql_database_instance`
3+
```

google-beta/resource_gke_hub_feature_membership_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"fmt"
66
"testing"
77

8-
"github.com/GoogleCloudPlatform/declarative-resource-client-library/dcl"
8+
dcl "github.com/GoogleCloudPlatform/declarative-resource-client-library/dcl"
99
gkehub "github.com/GoogleCloudPlatform/declarative-resource-client-library/services/google/gkehub/beta"
1010
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
1111
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"

google-beta/resource_sql_database_instance.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,11 @@ settings.backup_configuration.binary_log_enabled are both set to true.`,
238238
},
239239
},
240240
},
241+
"collation": {
242+
Type: schema.TypeString,
243+
Optional: true,
244+
Description: `The name of server instance collation.`,
245+
},
241246
"crash_safe_replication": {
242247
Type: schema.TypeBool,
243248
Optional: true,
@@ -991,6 +996,7 @@ func expandSqlDatabaseInstanceSettings(configured []interface{}, secondGen bool)
991996
ForceSendFields: []string{"StorageAutoResize"},
992997
ActivationPolicy: _settings["activation_policy"].(string),
993998
AvailabilityType: _settings["availability_type"].(string),
999+
Collation: _settings["collation"].(string),
9941000
CrashSafeReplicationEnabled: _settings["crash_safe_replication"].(bool),
9951001
DataDiskSizeGb: int64(_settings["disk_size"].(int)),
9961002
DataDiskType: _settings["disk_type"].(string),
@@ -1396,6 +1402,7 @@ func flattenSettings(settings *sqladmin.Settings) []map[string]interface{} {
13961402
"activation_policy": settings.ActivationPolicy,
13971403
"authorized_gae_applications": settings.AuthorizedGaeApplications,
13981404
"availability_type": settings.AvailabilityType,
1405+
"collation": settings.Collation,
13991406
"crash_safe_replication": settings.CrashSafeReplicationEnabled,
14001407
"disk_type": settings.DataDiskType,
14011408
"disk_size": settings.DataDiskSizeGb,

google-beta/resource_sql_database_instance_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -958,6 +958,7 @@ resource "google_sql_database_instance" "instance" {
958958
deletion_protection = false
959959
settings {
960960
tier = "db-custom-1-3840"
961+
collation = "Polish_CI_AS"
961962
}
962963
}
963964
`

website/docs/d/sql_database_instance.html.markdown

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ The `settings` block contains:
6363
* `availability_type` - The availability type of the Cloud SQL
6464
instance, high availability (`REGIONAL`) or single zone (`ZONAL`).
6565

66+
* `collation` - The name of server instance collation.
67+
6668
* `crash_safe_replication` - (Deprecated) This property is only applicable to First Generation instances.
6769
First Generation instances are now deprecated, see [here](https://cloud.google.com/sql/docs/mysql/upgrade-2nd-gen)
6870

website/docs/r/sql_database_instance.html.markdown

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,8 @@ instance, high availability (`REGIONAL`) or single zone (`ZONAL`).' For MySQL
262262
instances, ensure that `settings.backup_configuration.enabled` and
263263
`settings.backup_configuration.binary_log_enabled` are both set to `true`.
264264

265+
* `collation` - (Optional) The name of server instance collation.
266+
265267
* `crash_safe_replication` - (Optional, Deprecated) This property is only applicable to First Generation instances.
266268
First Generation instances are now deprecated, see [here](https://cloud.google.com/sql/docs/mysql/upgrade-2nd-gen)
267269
for information on how to upgrade to Second Generation instances.

0 commit comments

Comments
 (0)