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

Remove collation from update request and make collation non-updatable #6298

Merged
merged 1 commit into from
Jul 19, 2022
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
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@ is set to true.`,
"collation": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
Description: `The name of server instance collation.`,
},
"database_flags": {
Expand Down Expand Up @@ -1307,6 +1308,9 @@ func resourceSqlDatabaseInstanceUpdate(d *schema.ResourceData, meta interface{})
Settings: expandSqlDatabaseInstanceSettings(d.Get("settings").([]interface{})),
}

// Collation cannot be included in the update request
instance.Settings.Collation = ""

// Lock on the master_instance_name just in case updating any replica
// settings causes operations on the master.
if v, ok := d.GetOk("master_instance_name"); ok {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,16 @@ func TestAccSqlDatabaseInstance_basicMSSQL(t *testing.T) {
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"root_password", "deletion_protection"},
},
{
Config: fmt.Sprintf(
testGoogleSqlDatabaseInstance_update_mssql, databaseName, rootPassword),
},
{
ResourceName: "google_sql_database_instance.instance",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"root_password", "deletion_protection"},
},
},
})
}
Expand Down Expand Up @@ -1223,6 +1233,23 @@ resource "google_sql_database_instance" "instance" {
}
`

var testGoogleSqlDatabaseInstance_update_mssql = `
resource "google_sql_database_instance" "instance" {
name = "%s"
database_version = "SQLSERVER_2019_STANDARD"
root_password = "%s"
deletion_protection = false
settings {
tier = "db-custom-1-3840"
collation = "Polish_CI_AS"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This won't force recreation because it's using the same collation as the previous config, but will update another field to ensure collation isn't sent & rejected?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep!

made sure in local testing that update request was sent here

ip_configuration {
ipv4_enabled = true
require_ssl = true
}
}
}
`

func testGoogleSqlDatabaseInstance_ActiveDirectoryConfig(databaseName, networkName, addressRangeName, rootPassword, adDomainName string) string {
return fmt.Sprintf(`
data "google_compute_network" "servicenet" {
Expand Down