magic-modules icon indicating copy to clipboard operation
magic-modules copied to clipboard

add autoNetworkTier to Router NAT

Open maxi-cit opened this issue 2 years ago • 19 comments

Fixes: https://github.com/hashicorp/terraform-provider-google/issues/16139

It adds support to set the network tier to use when automatically reserving NAT IP Addresses

If this PR is for Terraform, I acknowledge that I have:

  • [x] Searched through the issue tracker for an open issue that this either resolves or contributes to, commented on it to claim it, and written "fixes {url}" or "part of {url}" in this PR description. If there were no relevant open issues, I opened one and commented that I would like to work on it (not necessary for very small changes).
  • [x] Ensured that all new fields I added that can be set by a user appear in at least one example (for generated resources) or third_party test (for handwritten resources or update tests).
  • [x] Generated Terraform providers, and ran make test and make lint in the generated providers to ensure it passes unit and linter tests.
  • [x] Ran relevant acceptance tests using my own Google Cloud project and credentials (If the acceptance tests do not yet pass or you are unable to run them, please let your reviewer know).
  • [x] Read Write release notes before writing my release note below.

Release Note Template for Downstream PRs (will be copied)

compute: added `auto_network_tier` field to `google_compute_router_nat` resource

maxi-cit avatar Oct 30 '23 11:10 maxi-cit

Hello! I am a robot. It looks like you are a: Community Contributor ~Googler~ ~Core Contributor~. Tests will require approval 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.

modular-magician avatar Oct 30 '23 11:10 modular-magician

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.

Terraform GA: Diff ( 2 files changed, 38 insertions(+)) Terraform Beta: Diff ( 2 files changed, 38 insertions(+))

Missing test report

Your PR includes resource fields which are not covered by any test.

Resource: google_compute_router_nat (11 total tests) Please add an acceptance test which includes these fields. The test should include the following:

resource "google_compute_router_nat" "primary" {
  auto_network_tier = # value needed
}

modular-magician avatar Oct 30 '23 20:10 modular-magician

Tests analytics

Total tests: 3184 Passed tests 2855 Skipped tests: 325 Affected tests: 4

Action taken

Found 4 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
TestAccComputeRouterNat_update|TestAccComputeRouterNat_basic|TestAccComputeRouterNat_removeLogConfig|TestAccDataSourceGoogleComputeRouterNat_basic

Get to know how VCR tests work

modular-magician avatar Oct 30 '23 21:10 modular-magician

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

modular-magician avatar Oct 30 '23 21:10 modular-magician

Hello @trodge, I have been studying the first case and I think is somewhat doable. However, could you explain about the latter case, please?

maxi-cit avatar Nov 07 '23 13:11 maxi-cit

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.

Terraform GA: Diff ( 2 files changed, 38 insertions(+)) Terraform Beta: Diff ( 2 files changed, 38 insertions(+))

Missing test report

Your PR includes resource fields which are not covered by any test.

Resource: google_compute_router_nat (11 total tests) Please add an acceptance test which includes these fields. The test should include the following:

resource "google_compute_router_nat" "primary" {
  auto_network_tier = # value needed
}

modular-magician avatar Nov 17 '23 21:11 modular-magician

Tests analytics

Total tests: 3235 Passed tests 2901 Skipped tests: 330 Affected tests: 4

Action taken

Found 4 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
TestAccComputeRouterNat_update|TestAccComputeRouterNat_removeLogConfig|TestAccComputeRouterNat_basic|TestAccDataSourceGoogleComputeRouterNat_basic

Get to know how VCR tests work

modular-magician avatar Nov 17 '23 22:11 modular-magician

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

modular-magician avatar Nov 17 '23 22:11 modular-magician

Hello @trodge, I have been studying the first case and I think is somewhat doable. However, could you explain about the latter case, please?

Setting default_from_api will make the field Optional and Computed in the provider, which means that any value returned from the API will be treated as though it matches an empty value in the user's config.

trodge avatar Dec 01 '23 02:12 trodge

Helllo @trodge I tried to implement your encoder fix so it will take the project default when empty. Could you take a look, please?

maxi-cit avatar Jan 23 '24 13:01 maxi-cit

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.

Terraform GA: Diff ( 2 files changed, 69 insertions(+)) Terraform Beta: Diff ( 3 files changed, 112 insertions(+), 5 deletions(-))

Missing test report

Your PR includes resource fields which are not covered by any test.

Resource: google_compute_router_nat (17 total tests) Please add an acceptance test which includes these fields. The test should include the following:

resource "google_compute_router_nat" "primary" {
  auto_network_tier = # value needed
}

modular-magician avatar Feb 16 '24 23:02 modular-magician

Tests analytics

Total tests: 887 Passed tests 802 Skipped tests: 72 Affected tests: 13

Click here to see the affected service packages
  • compute

Action taken

Found 13 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
TestAccComputeRouterNat_withPrivateNat|TestAccComputeRouterNat_AutoNetworkTier|TestAccComputeRouterNat_withManualIpAndSubnetConfiguration|TestAccComputeRouterNat_withNatRules|TestAccComputeRouterNat_withPortAllocationMethods|TestAccComputeRouterNat_withNatIpsAndDrainNatIps|TestAccDataSourceGoogleComputeRouterNat_basic|TestAccComputeRouterNat_withPrivateNatAndEmptyActionActiveRanges|TestAccComputeRouterNat_update|TestAccComputeRouterNat_removeLogConfig|TestAccComputeRouterNat_withPrivateNatAndEmptyAction|TestAccComputeRouterNat_basic|TestAccComputeRouterNat_withPrivateNatAndRules

Get to know how VCR tests work

modular-magician avatar Feb 16 '24 23:02 modular-magician

$\textcolor{green}{\textsf{Tests passed during RECORDING mode:}}$ TestAccComputeRouterNat_withPrivateNat[Debug log] TestAccComputeRouterNat_withManualIpAndSubnetConfiguration[Debug log] TestAccComputeRouterNat_withNatRules[Debug log] TestAccComputeRouterNat_withPortAllocationMethods[Debug log] TestAccComputeRouterNat_withNatIpsAndDrainNatIps[Debug log] TestAccComputeRouterNat_withPrivateNatAndRules[Debug log]

Rerun these tests in REPLAYING mode to catch issues

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


$\textcolor{red}{\textsf{Tests failed during RECORDING mode:}}$ TestAccComputeRouterNat_AutoNetworkTier[Error message] [Debug log] TestAccDataSourceGoogleComputeRouterNat_basic[Error message] [Debug log] TestAccComputeRouterNat_withPrivateNatAndEmptyActionActiveRanges[Error message] [Debug log] TestAccComputeRouterNat_update[Error message] [Debug log] TestAccComputeRouterNat_removeLogConfig[Error message] [Debug log] TestAccComputeRouterNat_withPrivateNatAndEmptyAction[Error message] [Debug log] TestAccComputeRouterNat_basic[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

modular-magician avatar Feb 16 '24 23:02 modular-magician

@maxi-cit is this PR still active?

melinath avatar Apr 05 '24 22:04 melinath

Hello @melinath, sorry for the late reply. it is active but other products got higher prio. However I will comeback to this one later in the week.

maxi-cit avatar Apr 09 '24 17:04 maxi-cit

Hello @trodge I updated this PR making this new field default_from_api. I tried the encoder fix but it does not seems that this field should be tied to the project level default changes. I believe that we can have this field 'immutable' so it gets recreated anytime the API returns a different network tier value. do you think I should add a special note for this field?

maxi-cit avatar Apr 23 '24 16:04 maxi-cit

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, 80 insertions(+)) google-beta provider: Diff ( 3 files changed, 85 insertions(+), 5 deletions(-))

Missing test report

Your PR includes resource fields which are not covered by any test.

Resource: google_compute_router_nat (21 total tests) Please add an acceptance test which includes these fields. The test should include the following:

resource "google_compute_router_nat" "primary" {
  auto_network_tier = # value needed
}

modular-magician avatar Apr 23 '24 19:04 modular-magician

Tests analytics

Total tests: 900 Passed tests: 820 Skipped tests: 72 Affected tests: 8

Click here to see the affected service packages
  • compute

Action taken

Found 8 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
TestAccComputeRegionPerInstanceConfig_removeInstanceOnDestroy|TestAccComputeRouterNat_AutoNetworkTier|TestAccComputeRouterNat_withManualIpAndSubnetConfiguration|TestAccComputeRouterNat_withNatIpsAndDrainNatIps|TestAccComputeRouterNat_withNatRules|TestAccComputeRouterNat_withPortAllocationMethods|TestAccComputeRouterNat_withPrivateNat|TestAccComputeRouterNat_withPrivateNatAndRules

Get to know how VCR tests work

modular-magician avatar Apr 23 '24 19:04 modular-magician

$\textcolor{green}{\textsf{Tests passed during RECORDING mode:}}$ TestAccComputeRegionPerInstanceConfig_removeInstanceOnDestroy[Debug log] TestAccComputeRouterNat_AutoNetworkTier[Debug log] TestAccComputeRouterNat_withManualIpAndSubnetConfiguration[Debug log] TestAccComputeRouterNat_withNatIpsAndDrainNatIps[Debug log] TestAccComputeRouterNat_withNatRules[Debug log] TestAccComputeRouterNat_withPortAllocationMethods[Debug log] TestAccComputeRouterNat_withPrivateNat[Debug log] TestAccComputeRouterNat_withPrivateNatAndRules[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

modular-magician avatar Apr 23 '24 19:04 modular-magician

/gcbrun

trodge avatar May 07 '24 17:05 trodge

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, 80 insertions(+)) google-beta provider: Diff ( 3 files changed, 85 insertions(+), 5 deletions(-))

Missing test report

Your PR includes resource fields which are not covered by any test.

Resource: google_compute_router_nat (21 total tests) Please add an acceptance test which includes these fields. The test should include the following:

resource "google_compute_router_nat" "primary" {
  auto_network_tier = # value needed
}

modular-magician avatar May 07 '24 18:05 modular-magician

Tests analytics

Total tests: 907 Passed tests: 834 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
TestAccComputeRegionPerInstanceConfig_removeInstanceOnDestroy

Get to know how VCR tests work

modular-magician avatar May 07 '24 19:05 modular-magician

$\textcolor{green}{\textsf{Tests passed during RECORDING mode:}}$ TestAccComputeRegionPerInstanceConfig_removeInstanceOnDestroy[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

modular-magician avatar May 07 '24 19:05 modular-magician

Hello @trodge thanks for the feedback. I applied your suggestions and moved the function. This should be fixing it, but if fails on the ga-provider I will make a separate one

maxi-cit avatar May 08 '24 15:05 maxi-cit

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, 148 insertions(+)) google-beta provider: Diff ( 3 files changed, 122 insertions(+), 42 deletions(-))

Missing test report

Your PR includes resource fields which are not covered by any test.

Resource: google_compute_router_nat (21 total tests) Please add an acceptance test which includes these fields. The test should include the following:

resource "google_compute_router_nat" "primary" {
  auto_network_tier = # value needed
}

modular-magician avatar May 08 '24 20:05 modular-magician

Tests analytics

Total tests: 914 Passed tests: 842 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

modular-magician avatar May 08 '24 20:05 modular-magician