magic-modules
magic-modules copied to clipboard
Add reservedInternalRange fields to the google_compute_subnetwork resource
Fixes: https://github.com/hashicorp/terraform-provider-google/issues/17881
Release Note Template for Downstream PRs (will be copied)
compute: added fields `reserved_internal_range` and `secondary_ip_ranges[].reserved_internal_range` to `google_compute_subnetwork` resource
Hello! I am a robot. Tests will require approval from a repository maintainer to run.
@trodge, 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 @trodge, happy to receive your review on this PR. Thanks!
Hi there, I'm the Modular magician. I've detected the following information about your changes:
Diff report
Your PR generated some diffs in downstreams - here they are.
google
provider: Diff ( 3 files changed, 98 insertions(+), 6 deletions(-))
google-beta
provider: Diff ( 3 files changed, 153 insertions(+), 9 deletions(-))
terraform-google-conversion
: Diff ( 1 file changed, 21 insertions(+))
Missing test report
Your PR includes resource fields which are not covered by any test.
Resource: google_compute_subnetwork
(451 total tests)
Please add an acceptance test which includes these fields. The test should include the following:
resource "google_compute_subnetwork" "primary" {
secondary_ip_range {
reserved_internal_range = # value needed
}
}
Tests analytics
Total tests: 906
Passed tests: 833
Skipped tests: 72
Affected tests: 1
Click here to see the affected service packages
- compute
Action taken
Found 1 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
TestAccComputeSubnetwork_subnetworkReservedInternalRangeExample
$\textcolor{red}{\textsf{Tests failed during RECORDING mode:}}$
TestAccComputeSubnetwork_subnetworkReservedInternalRangeExample
[Error message] [Debug log]
$\textcolor{red}{\textsf{Please fix these to complete your PR.}}$ View the build log or the debug log for each test
Hi there, I'm the Modular magician. I've detected the following information about your changes:
Diff report
Your PR generated some diffs in downstreams - here they are.
google
provider: Diff ( 3 files changed, 101 insertions(+), 6 deletions(-))
google-beta
provider: Diff ( 3 files changed, 159 insertions(+), 9 deletions(-))
terraform-google-conversion
: Diff ( 1 file changed, 21 insertions(+))
Missing test report
Your PR includes resource fields which are not covered by any test.
Resource: google_compute_subnetwork
(451 total tests)
Please add an acceptance test which includes these fields. The test should include the following:
resource "google_compute_subnetwork" "primary" {
secondary_ip_range {
reserved_internal_range = # value needed
}
}
Tests analytics
Total tests: 906
Passed tests: 833
Skipped tests: 72
Affected tests: 1
Click here to see the affected service packages
- compute
Action taken
Found 1 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
TestAccComputeSubnetwork_subnetworkReservedInternalRangeExample
$\textcolor{red}{\textsf{Tests failed during RECORDING mode:}}$
TestAccComputeSubnetwork_subnetworkReservedInternalRangeExample
[Error message] [Debug log]
$\textcolor{red}{\textsf{Please fix these to complete your PR.}}$ View the build log or the debug log for each test
The test is failing with this error:
2024-04-30T18:59:52.071Z [ERROR] sdk.helper_resource: Unexpected error: test_working_directory=/tmp/plugintest168036712 test_step_number=1
error=
| Error running pre-apply refresh: exit status 1
|
| Error: Missing required argument
|
| on terraform_plugin_test.tf line 2, in resource "google_compute_subnetwork" "subnetwork_with_reserved_internal_range":
| 2: resource "google_compute_subnetwork" "subnetwork_with_reserved_internal_range" {
|
| The argument "ip_cidr_range" is required, but no definition was found.
test_name=TestAccComputeSubnetwork_subnetworkReservedInternalRangeExample test_terraform_path=/bin/terraform
The test is failing with this error:
2024-04-30T18:59:52.071Z [ERROR] sdk.helper_resource: Unexpected error: test_working_directory=/tmp/plugintest168036712 test_step_number=1 error= | Error running pre-apply refresh: exit status 1 | | Error: Missing required argument | | on terraform_plugin_test.tf line 2, in resource "google_compute_subnetwork" "subnetwork_with_reserved_internal_range": | 2: resource "google_compute_subnetwork" "subnetwork_with_reserved_internal_range" { | | The argument "ip_cidr_range" is required, but no definition was found. test_name=TestAccComputeSubnetwork_subnetworkReservedInternalRangeExample test_terraform_path=/bin/terraform
Hey @trodge, It appears that ipCidrRange
becomes optional once reserved_internal_range
is defined. Currently, it's set as required. What is the recommended approach here? I see two options:
- Making
ipCidrRange
in both primary and secondary ranges optional and document the use case when it's required - Creating custom code to populate those fields once
ipCidrRange
is empty (in either primary/secondary) andreserved_internal_range
is set
I Just tested option 1, setting ipCidrRange
to optional and default_from_api
to true, then test it again and the test passes.
Happy to hear your thoughts.
The test is failing with this error:
2024-04-30T18:59:52.071Z [ERROR] sdk.helper_resource: Unexpected error: test_working_directory=/tmp/plugintest168036712 test_step_number=1 error= | Error running pre-apply refresh: exit status 1 | | Error: Missing required argument | | on terraform_plugin_test.tf line 2, in resource "google_compute_subnetwork" "subnetwork_with_reserved_internal_range": | 2: resource "google_compute_subnetwork" "subnetwork_with_reserved_internal_range" { | | The argument "ip_cidr_range" is required, but no definition was found. test_name=TestAccComputeSubnetwork_subnetworkReservedInternalRangeExample test_terraform_path=/bin/terraform
Hey @trodge, It appears that
ipCidrRange
becomes optional oncereserved_internal_range
is defined. Currently, it's set as required. What is the recommended approach here? I see two options:
- Making
ipCidrRange
in both primary and secondary ranges optional and document the use case when it's required- Creating custom code to populate those fields once
ipCidrRange
is empty (in either primary/secondary) andreserved_internal_range
is setI Just tested option 1, setting
ipCidrRange
to optional anddefault_from_api
to true, then test it again and the test passes.Happy to hear your thoughts.
Making the field optional should be fine.
Hi there, I'm the Modular magician. I've detected the following information about your changes:
Diff report
Your PR generated some diffs in downstreams - here they are.
google
provider: Diff ( 3 files changed, 137 insertions(+), 32 deletions(-))
google-beta
provider: Diff ( 3 files changed, 195 insertions(+), 35 deletions(-))
terraform-google-conversion
: Diff ( 1 file changed, 21 insertions(+))
Missing test report
Your PR includes resource fields which are not covered by any test.
Resource: google_compute_subnetwork
(453 total tests)
Please add an acceptance test which includes these fields. The test should include the following:
resource "google_compute_subnetwork" "primary" {
secondary_ip_range {
reserved_internal_range = # value needed
}
}
Tests analytics
Total tests: 906
Passed tests: 833
Skipped tests: 72
Affected tests: 1
Click here to see the affected service packages
- compute
Action taken
Found 1 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
TestAccComputeSubnetwork_subnetworkReservedInternalRangeExample
$\textcolor{green}{\textsf{Tests passed during RECORDING mode:}}$
TestAccComputeSubnetwork_subnetworkReservedInternalRangeExample
[Debug log]
$\textcolor{green}{\textsf{No issues found for passed tests after REPLAYING rerun.}}$
$\textcolor{green}{\textsf{All tests passed!}}$ View the build log or the debug log for each test
It looks like this needed to be reverted due to a breaking change. We will probably need to make this change in the next major release.
It looks like this needed to be reverted due to a breaking change. We will probably need to make this change in the next major release.
Ah pity! Anyway, happy to help. How should we proceed from here @trodge?
@trodge i saw the announcement for Terraform v6. Is this change coming to v6? I would really be helped having this feature. Is there maybe a way to integrate internal ranges on just the primary range?