-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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 ability to update Bigtable instance cluster node count #4026
add ability to update Bigtable instance cluster node count #4026
Conversation
Hey @mackenziestarr! Thanks for your contribution. Unfortunately, I believe that changing the type of Assuming the functionality discussed at the end in #2521 is exposed in the client libraries, we'll be able to add this in a future |
Hi @rileykarson thanks for taking a look. I converted that to
I see your point about |
I'm not aware of a workaround for the issue that wouldn't constitute a breaking change for users (I looked into the same topic a few days ago). I see two possible paths forward:
|
@rileykarson just to clarify on the second option, how would that work with fields that can't be changed like |
Ideally the client lib / API would throw a validation error if we attempted an impossible change, but we can work around it if it doesn't. This functionality was recently added to the grpc client with https://code-review.googlesource.com/c/gocloud/+/42850. With that implementation, adding/removing clusters isn't possible (which could simplify our client code considerably 🙁 ). Regardless, it means we don't need to own much code in our Looking at this again, I think that we can safely make this change with approach #1, provided we can perform diff comparisons in a I believe all we need to do is make the same schema changes you've made, and add the CD to make sure that ordering of the list doesn't matter. |
hey @rileykarson thanks for all the info I think with the prior art there I can take a shot at implementing a |
Sounds good! If you're stuck, feel free to reach out here. |
Hey @rileykarson when I went to implement this change I noticed this from the
Given that, should I expect to have to modify the schema similar to this PR? |
Yep! Because of that change, in the customizediff we'll need to verify that the new |
Hey @rileykarson I managed to get a passing test for reordering clusters when making changes but I still need to handle the reordering cases where additional clusters are added / removed. Hopefully I'll have that soon! |
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.
If adding / removing clusters isn't necessary for your usecase, I'd prefer to omit it for now I think. If you return nil in the cases where count doesn't match at https://github.com/terraform-providers/terraform-provider-google/pull/4026/files#diff-97a6b5054641d12f7b5a4b1aafe531b0R322-R328 I think that's sufficient? Terraform will display a (probably ugly, but workable) diff that causes the instance to recreate.
I also left some surface-level comments on a couple pieces of the customizediff.
@@ -12,6 +12,7 @@ func TestAccBigtableInstanceIamBinding(t *testing.T) { | |||
t.Parallel() | |||
|
|||
instance := "tf-bigtable-iam-" + acctest.RandString(10) | |||
cluster := "c-" + acctest.RandString(10) |
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.
Good catch!
1562921
to
4fdeabe
Compare
@rileykarson refactored the code a bit in 376017d to make it cleaner and fixed up the diff with regard to #4156, thanks for the review! |
@rileykarson just bumping this, I think it’s ready to be merged |
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.
Sorry! The notification that you'd updated the PR got eaten, thanks for pinging me.
Just a couple more small things commented inline.
…er review comments - add ForceNew back to display_name attribute
@rileykarson no worries, that happens to me as well with github notifications sometimes — just updated with some new test cases to cover the failure conditions you pointed out. |
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.
LGTM, thanks for contributing @mackenziestarr!
I'll upstream these changes to Magic Modules so they're applied to the beta provider as well, and then merge this PR.
Adding changelog metadata:
|
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks! |
This PR allows the Bigtable instance cluster
num_nodes
to updated without forcing the instance to be re-created. I also tried to support upgrading from aDEVELOPMENT
to aPRODUCTION
instance but the bigtable package only exposes that information at instance creation time. Switching to thev2
admin API would allow this via Instance.GetType but for now I've left theinstance_type
schema asForceNew
. All tests undermake testacc TEST=./google TESTARGS='-run=TestAccBigtableInstance*'
pass for me.fixes #2521