-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Don't recreate GCE instances when updating resource_policies property #5206
Don't recreate GCE instances when updating resource_policies property #5206
Conversation
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed (or fixed any issues), please reply here with What to do if you already signed the CLAIndividual signers
Corporate signers
ℹ️ Googlers: Go here for more info. |
Oops! It looks like you're using an unknown release-note type in your changelog entries:
Please only use the types listed in https://github.com/GoogleCloudPlatform/magic-modules/blob/master/.ci/RELEASE_NOTES_GUIDE.md. |
Hello! I am a robot who works on Magic Modules PRs. I have detected that you are a community contributor, so your PR will be assigned to someone with a commit-bit on this repo for initial review. Thanks for your contribution! A human will be with you soon. @rileykarson, please review this PR or find an appropriate assignee. |
@googlebot I signed it! |
Great! Let's run those tests. /gcbrun |
Great, all those tests pass. We're ready to merge as soon as our CI pipeline is back up and healthy. :) |
@hanneshayashi Are you able to add an update test for this, or maybe to show that you've tested it and it updates correctly? mmv1/third_party/terraform/tests/resource_compute_instance_test.go.erb would be where to add the test if you're able. |
Sure, I'll give it a try. |
@ndmckinley I just added a test case that creates a new instance and an instance scheduler. The test has steps to add, update and remove the resource policy from the instance. I sincerely hope that I didn't mess anything up with the Magic Modules stuff. Just in case, I also pushed the test to the original PR (hashicorp/terraform-provider-google#10029). |
Looks great, let's run those tests. /gcbrun |
Ah, CI node unhealthy, those happen intermittently. Let's try again. /gcbrun |
Two in a row! PR's full of bad luck. /gcbrun one more try. |
Thanks for running the tests! Assuming the current failure is not due to my code and that this change can be merged soon-ish, what version can the change reasonably be expected to be included in? |
/gcbrun |
Hashicorp CI still seems to be down, but I'll keep trying - if this goes in today, then it will go out on the 27th - otherwise, the 4th. Release cuts are usually Tuesday, for release in the afternoon PST on the following Monday (excepting holidays, surprises, bad luck - we're pretty consistent but not absolutely perfect about it). |
I have triggered VCR tests in RECORDING mode for the following tests that failed during VCR: TestAccBigQueryDataTable_bigtable|TestAccBigtableAppProfile_bigtableAppProfileSingleclusterExample|TestAccBigtableAppProfile_bigtableAppProfileMulticlusterExample|TestAccComputeForwardingRule_update|TestAccComputeInstance_resourcePolicyUpdate|TestAccComputeServiceAttachment_serviceAttachmentBasicExample|TestAccOrgPolicyPolicy_EnforcePolicy|TestAccOrgPolicyPolicy_FolderPolicy|TestAccOrgPolicyPolicy_OrganizationPolicy|TestAccOrgPolicyPolicy_ProjectPolicy|TestAccTags You can view the result here: https://ci-oss.hashicorp.engineering/viewQueued.html?itemId=206728 |
@hanneshayashi Okay! I have the tests running and I have verified there are no new failures. However, the test you added is causing this failure:
Which must be a permissions difference between your env and ours. Can you tell me what perms you had to give that service account, so I can replicate it on our side? I tried |
Ah, my bad! I sort of assumed that there already was a test case somewhere for the instance schedulers, so I didn't think about the permissions. According to https://cloud.google.com/compute/docs/instances/schedule-instance-start-stop#before-you-begin, the Service Agent account (so |
@ndmckinley have you had a chance to take another look? I suppose I could replace the instance schedulers with something else in the test, if you have a suggestion. I just used them because they are my use-case :) |
Ah, admin v1! Thank you, I'll do that. |
/gcbrun |
I have triggered VCR tests in RECORDING mode for the following tests that failed during VCR: TestAccComposerEnvironment_update|TestAccComposerEnvironment_withSoftwareConfig|TestAccComputeInstance_resourcePolicyUpdate|TestAccComputeServiceAttachment_serviceAttachmentBasicExample|TestAccNetworkServicesEdgeCacheOrigin_networkServicesEdgeCacheOriginBasicExample You can view the result here: https://ci-oss.hashicorp.engineering/viewQueued.html?itemId=207791 |
Great, that test passes now! Let me see what's gone wrong with the linter... |
Hm, seems unrelated. |
Let's rerun it and see if it was transient? /gcbrun |
Aha, yes, confirmed it is unrelated. Merging! Thanks for your contribution. |
I have triggered VCR tests in RECORDING mode for the following tests that failed during VCR: TestAccNetworkServicesEdgeCacheOrigin_networkServicesEdgeCacheOriginAdvancedExample|TestAccNetworkServicesEdgeCacheService_networkServicesEdgeCacheServiceAdvancedExample You can view the result here: https://ci-oss.hashicorp.engineering/viewQueued.html?itemId=207804 |
…GoogleCloudPlatform#5206) * Don't recreate GCE instances when updating resource_policies property * Remove ForceNew * Add test case for update of resource_policies
This fixes the behaviour described in hashicorp/terraform-provider-google#9981.
Basically, the change removes the ForceNew attribute from the resource_policies property of google_compute_instance and adds code to check for changes of the property. If the property changed, all old values get removed and all new values (if there are any) get added.
The change was previously submitted in hashicorp/terraform-provider-google#10029
If this PR is for Terraform, I acknowledge that I have:
make test
andmake lint
to ensure it passes unit and linter tests.Release Note Template for Downstream PRs (will be copied)
Regarding tests: There doesn't seem to be a test specific for this behaviour. Do you need me to create one?