-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Support SQL Server Switchover (after resolving conflicts) #11850
base: main
Are you sure you want to change the base?
Conversation
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall no major concerns as long as the tests pass and the functionality works correctly
mmv1/third_party/terraform/services/sql/resource_sql_database_instance.go.erb
Outdated
Show resolved
Hide resolved
mmv1/third_party/terraform/services/sql/resource_sql_database_instance.go.erb
Outdated
Show resolved
Hide resolved
mmv1/third_party/terraform/services/sql/resource_sql_database_instance.go.erb
Outdated
Show resolved
Hide resolved
oldReplicaNames, newReplicaNames := d.GetChange("replica_names") | ||
_, newMasterInstanceName := d.GetChange("master_instance_name") | ||
_, newReplicaConfiguration := d.GetChange("replica_configuration") | ||
if len(newReplicaConfiguration.([]interface{})) != 1 || newReplicaConfiguration.([]interface{})[0] == nil{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are there docs on how this should work from an outside of Terraform perspective?
I'm having trouble figuring out why we expect switchover to only work if the new replica configuration is empty
replicaConfiguration := newReplicaConfiguration.([]interface{})[0].(map[string]interface{}) | ||
cascadableReplica, cascadableReplicaFieldExists := replicaConfiguration["cascadable_replica"] | ||
|
||
return newMasterInstanceName != nil && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a very confusing return statement to parse. Can you split this out somehow? I'd even prefer nested if statements
mmv1/third_party/terraform/services/sql/resource_sql_database_instance_test.go
Outdated
Show resolved
Hide resolved
mmv1/third_party/terraform/services/sql/resource_sql_database_instance_test.go
Outdated
Show resolved
Hide resolved
mmv1/third_party/terraform/services/sql/resource_sql_database_instance_test.go
Outdated
Show resolved
Hide resolved
mmv1/third_party/terraform/services/sql/resource_sql_database_instance_test.go
Outdated
Show resolved
Hide resolved
mmv1/third_party/terraform/services/sql/resource_sql_database_instance_test.go
Outdated
Show resolved
Hide resolved
Co-authored-by: Sam Levenick <[email protected]>
Support SQL Server Switchover through terraform
The full design doc can be found in go/sqlserver-switchover-terraform-proposal (Googler-only)
*This CL will NOT be submitted until the API changes are rolled out, and that my manual testing passes without causing a permadiff.