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

Support SQL Server Switchover (after resolving conflicts) #11850

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Philip-Jonany
Copy link

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.

Copy link

google-cla bot commented Sep 27, 2024

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.

@modular-magician modular-magician added the awaiting-approval Pull requests that needs reviewer's approval to run presubmit tests label Sep 27, 2024
Copy link
Contributor

@slevenick slevenick left a 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

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{
Copy link
Contributor

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 &&
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting-approval Pull requests that needs reviewer's approval to run presubmit tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants