Skip to content

Breaking change - Add integration for subnetworks with internal ranges API #10897

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

Conversation

daanheikens
Copy link
Contributor

Fixes: hashicorp/terraform-provider-google#17881

Second attempt, superseding: #10507

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

Copy link

github-actions bot commented Jun 6, 2024

Hello! I am a robot. Tests will require approval from a repository maintainer to run.

@roaks3, 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.

@github-actions github-actions bot requested a review from roaks3 June 6, 2024 18:14
@daanheikens
Copy link
Contributor Author

@trodge FYI! As discussed on: hashicorp/terraform-provider-google#18300

@c2thorn +1 for visibility

@modular-magician modular-magician added awaiting-approval Pull requests that need reviewer's approval to run presubmit tests service/compute-vpc and removed awaiting-approval Pull requests that need reviewer's approval to run presubmit tests labels Jun 6, 2024
@modular-magician
Copy link
Collaborator

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, 189 insertions(+), 32 deletions(-))
google-beta provider: Diff ( 3 files changed, 319 insertions(+), 35 deletions(-))
terraform-google-conversion: Diff ( 1 file changed, 21 insertions(+))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 958
Passed tests: 881
Skipped tests: 74
Affected tests: 3

Click here to see the affected service packages
  • compute

Action taken

Found 3 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
TestAccComputeInstanceNetworkIntefaceWithSecurityPolicy|TestAccComputeSubnetwork_subnetworkReservedInternalRangeExample|TestAccComputeSubnetwork_subnetworkReservedSecondaryRangeExample

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

$\textcolor{green}{\textsf{Tests passed during RECORDING mode:}}$
TestAccComputeSubnetwork_subnetworkReservedSecondaryRangeExample[Debug log]

$\textcolor{green}{\textsf{No issues found for passed tests after REPLAYING rerun.}}$


$\textcolor{red}{\textsf{Tests failed during RECORDING mode:}}$
TestAccComputeInstanceNetworkIntefaceWithSecurityPolicy[Error message] [Debug log]
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

Copy link

@roaks3 This PR has been waiting for review for 3 weekdays. Please take a look! Use the label disable-review-reminders to disable these notifications.

Copy link

@GoogleCloudPlatform/terraform-team @roaks3 This PR has been waiting for review for 1 week. Please take a look! Use the label disable-review-reminders to disable these notifications.

@roaks3
Copy link
Contributor

roaks3 commented Jun 13, 2024

@trodge passing this one to you, since it looks like you did the initial review. I'm not adding disable-review-reminders since you may want to take a look first, but otherwise it seems like we could add it here to keep the notifications quiet.

@roaks3 roaks3 requested review from trodge and removed request for roaks3 June 13, 2024 14:41
@c2thorn c2thorn changed the base branch from main to FEATURE-BRANCH-major-release-6.0.0 July 24, 2024 19:31
@c2thorn
Copy link
Member

c2thorn commented Jul 24, 2024

I've updated the base branch to point to the major release branch. This should be good to continue.

I've forgotten what the exact breaking change is here - but please follow the steps here to edit the upgrade guide so User's know how to handle the breaking change.

@daanheikens @trodge

@daanheikens
Copy link
Contributor Author

I've updated the base branch to point to the major release branch. This should be good to continue.

I've forgotten what the exact breaking change is here - but please follow the steps here to edit the upgrade guide so User's know how to handle the breaking change.

@daanheikens @trodge

Thank you @c2thorn, the issue was that one of the fields was treated required while it was optional. See also: #10697

If I recall correctly, it was related to this issue: hashicorp/terraform-provider-google#18115 where @rileykarson explains the issue in detail. I am not sure if it's already fixed in this major release, if not, we indeed have to update the documentation and add more tests I think?

Happy to hear your advice.

@c2thorn
Copy link
Member

c2thorn commented Jul 26, 2024

@daanheikens Thanks for the information. As I now understand, this is a breaking change due to the parent field having schema_config_mode_attr.

I planned on testing the effect of removing schema_config_mode_attr as part of 6.0, but have not gotten to it yet.

With schema_config_mode_attr, adding this new field is a breaking change because it becomes required.
Without schema_config_mode_attr, this should not be a breaking change, but it is unclear if removing schema_config_mode_attr itself is a breaking change. If you are interested in testing this out yourself as part of this PR that would be helpful, but otherwise I will have to report back in a few weeks after I've had time to test.

Assuming schema_config_mode_attr is removed outside of this PR, this will no longer be a breaking change and not need the associated breaking change documentation. But until someone is able to test removing schema_config_mode_attr, we should wait.

@trodge
Copy link
Contributor

trodge commented Aug 2, 2024

Removing schema_config_mode_attr would be a breaking change in that a config could produce this error:

  error=
  | exit status 1
  | 
  | Error: Unsupported argument
  | 
  |   on terraform_plugin_test.tf line 12, in resource "google_compute_subnetwork" "network-with-private-secondary-ip-ranges":
  |   12:   secondary_ip_range = []
  | 
  | An argument named "secondary_ip_range" is not expected here. Did you mean to
  | define a block of type "secondary_ip_range"?

If the user is attempting to use the current recommended method of specifying an empty block in order to remove secondary ip ranges from their config. (This being the workaround Riley mentions in hashicorp/terraform-provider-google#12824 )

If we're no longer concerned about maintaining 0.12 -> 0.13 forwards compatibility in the 6.0 version of the provider, could we remove schema_config_mode_attr and all tests/docs mentioning the [] syntax?

@daanheikens
Copy link
Contributor Author

Removing schema_config_mode_attr would be a breaking change in that a config could produce this error:

  error=
  | exit status 1
  | 
  | Error: Unsupported argument
  | 
  |   on terraform_plugin_test.tf line 12, in resource "google_compute_subnetwork" "network-with-private-secondary-ip-ranges":
  |   12:   secondary_ip_range = []
  | 
  | An argument named "secondary_ip_range" is not expected here. Did you mean to
  | define a block of type "secondary_ip_range"?

If the user is attempting to use the current recommended method of specifying an empty block in order to remove secondary ip ranges from their config. (This being the workaround Riley mentions in hashicorp/terraform-provider-google#12824 )

If we're no longer concerned about maintaining 0.12 -> 0.13 forwards compatibility in the 6.0 version of the provider, could we remove schema_config_mode_attr and all tests/docs mentioning the [] syntax?

@trodge @c2thorn I can try some variations here and write some tests/examples with schema_config_mode_attr removed if you are OK with that? Could you please guide me a bit in where I can start? Let me know, happy to help.

@c2thorn
Copy link
Member

c2thorn commented Aug 6, 2024

@trodge @c2thorn I can try some variations here and write some tests/examples with schema_config_mode_attr removed if you are OK with that? Could you please guide me a bit in where I can start? Let me know, happy to help.

I plan to get to testing other fields this week, but if you have time to start with this field, that would be helpful. With removing schema_config_mode_attr, we'd essentially just need to manually verify if it is possible to remove the field secondary_ip_ranges or not. I don't think there is a specific test that needs to be added to MMv1, what do you think @trodge

@trodge
Copy link
Contributor

trodge commented Aug 6, 2024

@trodge @c2thorn I can try some variations here and write some tests/examples with schema_config_mode_attr removed if you are OK with that? Could you please guide me a bit in where I can start? Let me know, happy to help.

I plan to get to testing other fields this week, but if you have time to start with this field, that would be helpful. With removing schema_config_mode_attr, we'd essentially just need to manually verify if it is possible to remove the field secondary_ip_ranges or not. I don't think there is a specific test that needs to be added to MMv1, what do you think @trodge

We have a test already that removes secondary ip ranges using secondary_ip_range = [] syntax. That would need to be updated to whatever the new syntax is along with the documentation.

Copy link

github-actions bot commented Aug 8, 2024

@GoogleCloudPlatform/terraform-team @trodge This PR has been waiting for review for 8 weeks. Please take a look! Use the label disable-review-reminders to disable these notifications.

@c2thorn
Copy link
Member

c2thorn commented Aug 8, 2024

Just updating that I'm getting to this now and should hopefully have an update tomorrow on the effect of removing schema_config_mode_attr and how to handle emptying fields without it.

@c2thorn
Copy link
Member

c2thorn commented Aug 9, 2024

After looking into this, this PR can be merged without removing schema_config_mode_attr from secondaryIpRange

I plan to remove schema_config_mode_attr separately after adding a 5.X workaround with #11410

So once that's done this should not be a breaking change, but it does need to go into the 6.0 branch.

@daanheikens
Copy link
Contributor Author

After looking into this, this PR can be merged without removing schema_config_mode_attr from secondaryIpRange

I plan to remove schema_config_mode_attr separately after adding a 5.X workaround with #11410

So once that's done this should not be a breaking change, but it does need to go into the 6.0 branch.

Ah great news @c2thorn. I do see the VCR test is still failing, anything we need to do for that?

@c2thorn
Copy link
Member

c2thorn commented Aug 9, 2024

Ah great news @c2thorn. I do see the VCR test is still failing, anything we need to do for that?

yes it looks like the error for TestAccComputeSubnetwork_subnetworkReservedInternalRangeExample is real

        Error: "name" ("") doesn't match regexp "^(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?)$"
        
          with google_compute_network.default,
          on terraform_plugin_test.tf line 12, in resource "google_compute_network" "default":
          12:   name                    = ""

@trodge

Copy link
Contributor

@trodge trodge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should fix the test error @c2thorn mentioned.

@github-actions github-actions bot requested a review from trodge August 13, 2024 11:58
@daanheikens
Copy link
Contributor Author

This should fix the test error @c2thorn mentioned.

Applied the suggestions!

@modular-magician modular-magician added awaiting-approval Pull requests that need reviewer's approval to run presubmit tests and removed awaiting-approval Pull requests that need reviewer's approval to run presubmit tests labels Aug 13, 2024
@modular-magician
Copy link
Collaborator

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, 189 insertions(+), 32 deletions(-))
google-beta provider: Diff ( 3 files changed, 319 insertions(+), 35 deletions(-))
terraform-google-conversion: Diff ( 1 file changed, 21 insertions(+))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 981
Passed tests: 909
Skipped tests: 72
Affected tests: 0

Click here to see the affected service packages
  • compute

$\textcolor{green}{\textsf{All tests passed!}}$

View the build log

@trodge trodge self-assigned this Aug 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add field reserved_internal_range and range to allow integration with the Internal Ranges API
5 participants