Added new fields ipVersion and ipCollection to secondaryIpRange in compute subnetwork resource to support secondary IPv6 ranges.#17412
Conversation
86cf3d3 to
37bc4da
Compare
|
Googlers: For automatic test runs see go/terraform-auto-test-runs. @c2thorn, a repository maintainer, has been assigned to review your changes. If you have not received review feedback within 2 business days, please leave a comment on this PR asking them to take a look. You can help make sure that review is quick by doing a self-review and by running impacted tests locally. |
|
Hi there, I'm the Modular magician. I've detected the following information about your changes for commit b343043: Diff reportYour PR generated the following diffs in downstream repositories:
Test reportAnalytics
Affected Service Packages
Step 1: Replaying Mode Action takenFound 5 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
View the build log Step 2: Recording Mode
Caution Issues requiring attention before PR completion 🔴 Initial Recording Failed: Some tests failed during the recording step. See the table above for details. Please address these issues to complete your PR. If you believe these detections are incorrect or unrelated to your change, please raise the concern with your reviewer. View the build log or the debug logs folder for detailed results. @Ummulkiram2410 VCR tests complete for b343043! |
|
Hi there, I'm the Modular magician. I've detected the following information about your changes for commit 3ef28d5: Diff reportYour PR generated the following diffs in downstream repositories:
Test reportAnalytics
Affected Service Packages
Step 1: Replaying Mode Action takenFound 4 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
View the build log Step 2: Recording Mode
Caution Issues requiring attention before PR completion 🔴 Initial Recording Failed: Some tests failed during the recording step. See the table above for details. Please address these issues to complete your PR. If you believe these detections are incorrect or unrelated to your change, please raise the concern with your reviewer. View the build log or the debug logs folder for detailed results. @Ummulkiram2410, @rileykarson VCR tests complete for 3ef28d5! |
|
Hi there, I'm the Modular magician. I've detected the following information about your changes for commit b008252: Diff reportYour PR generated the following diffs in downstream repositories:
Test reportAnalytics
Affected Service Packages
Step 1: Replaying Mode Action takenFound 3 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
View the build log Step 2: Recording Mode
Caution Issues requiring attention before PR completion 🔴 Initial Recording Failed: Some tests failed during the recording step. See the table above for details. Please address these issues to complete your PR. If you believe these detections are incorrect or unrelated to your change, please raise the concern with your reviewer. View the build log or the debug logs folder for detailed results. @Ummulkiram2410, @rileykarson VCR tests complete for b008252! |
|
Hi there, I'm the Modular magician. I've detected the following information about your changes for commit 67bf892: Diff reportYour PR generated the following diffs in downstream repositories:
Test reportAnalytics
Affected Service Packages
Step 1: Replaying Mode Action takenFound 1 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
View the build log Step 2: Recording Mode
Caution Issues requiring attention before PR completion 🔴 Initial Recording Failed: Some tests failed during the recording step. See the table above for details. Please address these issues to complete your PR. If you believe these detections are incorrect or unrelated to your change, please raise the concern with your reviewer. View the build log or the debug logs folder for detailed results. @Ummulkiram2410, @rileykarson VCR tests complete for 67bf892! |
|
Hi there, I'm the Modular magician. I've detected the following information about your changes for commit b731e13: Diff reportYour PR generated the following diffs in downstream repositories:
Test reportAnalytics
Affected Service Packages
Step 1: Replaying Mode Action takenFound 4 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
View the build log Step 2: Recording Mode
Caution Issues requiring attention before PR completion 🔴 Initial Recording Failed: Some tests failed during the recording step. See the table above for details. Please address these issues to complete your PR. If you believe these detections are incorrect or unrelated to your change, please raise the concern with your reviewer. View the build log or the debug logs folder for detailed results. @Ummulkiram2410, @rileykarson VCR tests complete for b731e13! |
This comment was marked as outdated.
This comment was marked as outdated.
|
@modular-magician reassign-reviewer c2thorn |
|
/gcbrun |
|
Hi there, I'm the Modular magician. I've detected the following information about your changes for commit 9188282: Diff reportYour PR generated the following diffs in downstream repositories:
Test reportAnalytics
Affected Service Packages
Step 1: Replaying Mode Action takenFound 37 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
View the build log Step 2: Recording Mode
Caution Issues requiring attention before PR completion 🔴 Initial Recording Failed: Some tests failed during the recording step. See the table above for details. Please address these issues to complete your PR. If you believe these detections are incorrect or unrelated to your change, please raise the concern with your reviewer. View the build log or the debug logs folder for detailed results. @Ummulkiram2410, @c2thorn VCR tests complete for 9188282! |
|
Hi there, I'm the Modular magician. I've detected the following information about your changes for commit 6ef9339: Diff reportYour PR generated the following diffs in downstream repositories:
Test reportAnalytics
Affected Service Packages
Step 1: Replaying Mode Action takenFound 21 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
View the build log Step 2: Recording Mode
Caution Issues requiring attention before PR completion 🔴 Initial Recording Failed: Some tests failed during the recording step. See the table above for details. 🔴 Replaying Rerun Failed: Some tests failed due to non-determinism when VCR replayed the response. See the table above for details. Please address these issues to complete your PR. If you believe these detections are incorrect or unrelated to your change, please raise the concern with your reviewer. View the build log or the debug logs folder for detailed results. @Ummulkiram2410, @rileykarson VCR tests complete for 6ef9339! |
|
Hi there, I'm the Modular magician. I've detected the following information about your changes for commit 0b9bc8a: Diff reportYour PR generated the following diffs in downstream repositories:
Test reportAnalytics
Affected Service Packages
Step 1: Replaying Mode Action takenFound 19 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
View the build log Step 2: Recording Mode
Caution Issues requiring attention before PR completion 🔴 Initial Recording Failed: Some tests failed during the recording step. See the table above for details. 🔴 Replaying Rerun Failed: Some tests failed due to non-determinism when VCR replayed the response. See the table above for details. Please address these issues to complete your PR. If you believe these detections are incorrect or unrelated to your change, please raise the concern with your reviewer. View the build log or the debug logs folder for detailed results. @Ummulkiram2410, @rileykarson VCR tests complete for 0b9bc8a! |
c2thorn
left a comment
There was a problem hiding this comment.
Two primary code change requests
| } | ||
|
|
||
| {{ if eq $.ProductMetadata.Compiler "terraformgoogleconversion-codegen" }} | ||
| // Dummy schema resource for tfplan2cai compilation |
There was a problem hiding this comment.
to satisfy google conversion gen, instead of stubbing this, can we just add this condition to the existing check within the customdiff function? so if the version is GA and the compiler is not google conversion
| } | ||
|
|
||
| func resourceComputeSubnetworkSecondaryIpRangeCustomDiffFunc(diff tpgresource.TerraformResourceDiff) error { | ||
| {{ if ne $.TargetVersionName `ga` -}} |
There was a problem hiding this comment.
| {{ if ne $.TargetVersionName `ga` -}} | |
| {{ if and (ne $.TargetVersionName "ga") (ne $.ProductMetadata.Compiler "terraformgoogleconversion-codegen") -}} |
see https://github.com/GoogleCloudPlatform/magic-modules/pull/17412/changes#r3244979835
| return resourceComputeSubnetworkSecondaryIpRangeCustomDiffFunc(diff) | ||
| } | ||
|
|
||
| func resourceComputeSubnetworkSecondaryIpRangeCustomDiffFunc(diff tpgresource.TerraformResourceDiff) error { |
There was a problem hiding this comment.
We now have two handwritten custom diff functions on the same parent field (technically three customdiffs total). For maintenance, I believe we should consider refactoring them to a single, large function so the different states and diff outcomes can be followed along within a single function vs mentally mapping them sequentially.
Maybe not for this PR as it's already large and having a large amount of testing as is.
| if configValueIsEmpty && !stateValueIsEmpty { | ||
| log.Printf("[DEBUG] setting secondary_ip_range to newly empty") | ||
| diff.SetNew("secondary_ip_range", make([]interface{}, 0)) | ||
| diff.SetNew("self_link", "send_empty_bypass") |
There was a problem hiding this comment.
We should not be forcing a diff here. The clientside check is something that we control in Magic Modules, and should bypass on the generator level, not on the diff level.
The generator template file lines that add the clientside check is here: https://github.com/GoogleCloudPlatform/magic-modules/blob/main/mmv1/templates/terraform/resource.go.tmpl#L855
I think the correct solution is to either add a new YAML-level flag to bypass the check, or make a new custom template that lets us change the check to whatever we want, allowing us to set a variable right here in sendSecondaryIpRangeIfEmptyDiff that gets checked during the update.
There was a problem hiding this comment.
@NickElliot what do you think? We have a situation that from the result of a customDiff, secondary_ip_range is Set to New and we need the update function to run. However for some reason d.HasChange returns false here, which triggers the clientside short-circuit.
There was a problem hiding this comment.
Adding a "bypass_clientside_update_check" flag feels reasonable to me, as long as the small comment line in resource.go clearly explains it should only be used for edge cases of an edge case where virtual fields flags that can be set in advance of an intended change are being used to detect explicit nulls on O+C fields.
Given how niche this scenario seems, I'm inclined to say it could be handled as a one-off for this resource but since it could come up again it might as well be a generator flag on that deletion_policy logic. In any event, Compute networks handle update calls very quickly so there is minimal downside to having it be excluded from a short circuit.
There was a problem hiding this comment.
Given how niche this scenario seems, I'm inclined to say it could be handled as a one-off for this resource but since it could come up again it might as well be a generator flag on that deletion_policy logic. In any event, Compute networks handle update calls very quickly so there is minimal downside to having it be excluded from a short circuit.
Thanks for the input, we'll go with that.
| "github.com/hashicorp/terraform-provider-google/google/tpgresource" | ||
| ) | ||
|
|
||
| func TestUnitComputeSubnetworkSecondaryIpRange_customizeDiff(t *testing.T) { |
|
Hi there, I'm the Modular magician. I've detected the following information about your changes for commit 4bc9a50: Diff reportYour PR generated the following diffs in downstream repositories:
Test reportAnalytics
Affected Service Packages
Step 1: Replaying Mode Action takenFound 17 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
View the replaying VCR build log Step 2: Recording Mode
Caution Issues requiring attention before PR completion 🔴 Initial Recording Failed: Some tests failed during the recording step. See the table above for details. 🔴 Replaying Rerun Failed: Some tests failed due to non-determinism when VCR replayed the response. See the table above for details. Please address these issues to complete your PR. If you believe these detections are incorrect or unrelated to your change, please raise the concern with your reviewer. View the recording VCR build log or the debug logs folder for detailed results. @Ummulkiram2410, @rileykarson, @c2thorn, @NickElliot VCR tests complete for 4bc9a50! |
…leconversionnext-codegen in secondary_ip_range custom diff
|
Hi there, I'm the Modular magician. I've detected the following information about your changes for commit e3cdcce: Diff reportYour PR generated the following diffs in downstream repositories:
Test reportAnalytics
Affected Service Packages
Step 1: Replaying Mode Action takenFound 16 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
View the replaying VCR build log Step 2: Recording Mode
Caution Issues requiring attention before PR completion 🔴 Initial Recording Failed: Some tests failed during the recording step. See the table above for details. 🔴 Replaying Rerun Failed: Some tests failed due to non-determinism when VCR replayed the response. See the table above for details. Please address these issues to complete your PR. If you believe these detections are incorrect or unrelated to your change, please raise the concern with your reviewer. View the recording VCR build log or the debug logs folder for detailed results. @Ummulkiram2410, @rileykarson, @c2thorn, @NickElliot VCR tests complete for e3cdcce! |
c2thorn
left a comment
There was a problem hiding this comment.
All review comments are addressed. I have reviewed a manual upgrade test (go/tf-secondary-ip-range-upgrade-test), and it looks good.
Failing VCR tests are not compute network related.
LGTM
9ad49be
Adds IpVersion and IpCollection to Subnetwork resource for providing support for secondary IPv6 ranges.
Manual Testing Doc to check if the change doesn't impact existing secondary IPv4 ranges:
go/tf-secondary-ip-range-upgrade-test