Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add collation to google_sql_database_instance #3557

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/5121.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
sql: added field `collation` to `google_sql_database_instance`
```
2 changes: 1 addition & 1 deletion google-beta/resource_gke_hub_feature_membership_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
7 changes: 7 additions & 0 deletions google-beta/resource_sql_database_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions google-beta/resource_sql_database_instance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -958,6 +958,7 @@ resource "google_sql_database_instance" "instance" {
deletion_protection = false
settings {
tier = "db-custom-1-3840"
collation = "Polish_CI_AS"
}
}
`
Expand Down
2 changes: 2 additions & 0 deletions website/docs/d/sql_database_instance.html.markdown
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
2 changes: 2 additions & 0 deletions website/docs/r/sql_database_instance.html.markdown
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