Skip to content
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

Adding noautomatednszone in the resource forwardingrule #8102

Conversation

diogoEsteves42
Copy link
Contributor

@diogoEsteves42 diogoEsteves42 commented Jun 7, 2023

Solves the issue: hashicorp/terraform-provider-google#14833

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

  • 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).
  • 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).
  • Generated Terraform providers, and ran make test and make lint in the generated providers to ensure it passes unit and linter tests.
  • 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).
  • Read the Release Notes Guide before writing my release note below.

Release Note Template for Downstream PRs (will be copied)

compute: added the `no_automate_dns_zone` field to `google_compute_forwarding_rule`.

@modular-magician
Copy link
Collaborator

Hello! I am a robot who works on Magic Modules PRs.

I've detected that you're a community contributor. @SarahFrench, a repository maintainer, has been assigned to assist you and help review your changes.

❓ First time contributing? Click here for more details

Your assigned reviewer will help review your code by:

  • Ensuring it's backwards compatible, covers common error cases, etc.
  • Summarizing the change into a user-facing changelog note.
  • Passes tests, either our "VCR" suite, a set of presubmit tests, or with manual test runs.

You can help make sure that review is quick by running local tests and ensuring they're passing in between each push you make to your PR's branch. Also, try to leave a comment with each push you make, as pushes generally don't generate emails.

If your reviewer doesn't get back to you within a week after your most recent change, please feel free to leave a comment on the issue asking them to take a look! In the absence of a dedicated review dashboard most maintainers manage their pending reviews through email, and those will sometimes get lost in their inbox.


@modular-magician modular-magician added awaiting-approval Pull requests that needs reviewer's approval to run presubmit tests and removed awaiting-approval Pull requests that needs reviewer's approval to run presubmit tests labels Jun 7, 2023
@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.

Terraform GA: Diff ( 5 files changed, 57 insertions(+))
Terraform Beta: Diff ( 6 files changed, 58 insertions(+))
TF Conversion: Diff ( 4 files changed, 24 insertions(+), 4 deletions(-))
TF OiCS: Diff ( 1 file changed, 1 insertion(+))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 2776
Passed tests 2475
Skipped tests: 292
Affected tests: 9

Action taken

Found 9 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
TestAccComputeGlobalForwardingRule_privateServiceConnectGoogleApisExample|TestAccComputeForwardingRule_forwardingRuleVpcPscExample|TestAccComputeFirewallPolicyRule_multipleRules|TestAccBigQueryDataTable_bigtable|TestAccApigeeKeystoresAliasesKeyCertFile_apigeeKeystoresAliasesKeyCertFileTestExample|TestAccApigeeKeystoresAliasesPkcs12_ApigeeKeystoresAliasesPkcs12Example|TestAccComputeForwardingRule_forwardingRuleVpcPscExampleUpdate|TestAccDataSourceGoogleFirebaseAndroidAppConfig|TestAccDataSourceAlloydbLocations_basic

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

Tests passed during RECORDING mode:
TestAccBigQueryDataTable_bigtable[Debug log]
TestAccApigeeKeystoresAliasesKeyCertFile_apigeeKeystoresAliasesKeyCertFileTestExample[Debug log]
TestAccApigeeKeystoresAliasesPkcs12_ApigeeKeystoresAliasesPkcs12Example[Debug log]
TestAccDataSourceAlloydbLocations_basic[Debug log]

Tests failed during RECORDING mode:
TestAccComputeGlobalForwardingRule_privateServiceConnectGoogleApisExample[Error message] [Debug log]
TestAccComputeForwardingRule_forwardingRuleVpcPscExample[Error message] [Debug log]
TestAccComputeFirewallPolicyRule_multipleRules[Error message] [Debug log]
TestAccComputeForwardingRule_forwardingRuleVpcPscExampleUpdate[Error message] [Debug log]
TestAccDataSourceGoogleFirebaseAndroidAppConfig[Error message] [Debug log]

Please fix these to complete your PR
View the build log or the debug log for each test

@SarahFrench
Copy link
Collaborator

SarahFrench commented Jun 7, 2023

Just an FYI in case you're not able to run the tests on your machine: the acceptance tests currently show some failures because Terraform has a non-empty plan after the acceptance tests finish the defined test steps. Terraform wants to change no_automate_dns_zone. For example, here's the error message for TestAccComputeGlobalForwardingRule_privateServiceConnectGoogleApisExample:

    vcr_utils.go:148: Step 1/2 error: After applying this test step, the plan was not empty.
        stdout:
        
        
        Terraform used the selected providers to generate the following execution
        plan. Resource actions are indicated with the following symbols:
        -/+ destroy and then create replacement
        
        Terraform will perform the following actions:
        
          # google_compute_global_forwarding_rule.default must be replaced
        -/+ resource "google_compute_global_forwarding_rule" "default" {
              - allow_psc_global_access = false -> null
              + base_forwarding_rule    = (known after apply)
              ~ id                      = "projects/PROJECT-HERE/global/forwardingRules/globalrulehn1qw8q3mr" -> (known after apply)
              ~ ip_address              = "100.100.100.106" -> "projects/PROJECT-HERE/global/addresses/tf-test-global-psconnect-iphn1qw8q3mr"
              ~ ip_protocol             = "TCP" -> (known after apply)
              ~ label_fingerprint       = "42WmSpB8rSM=" -> (known after apply)
                name                    = "globalrulehn1qw8q3mr"
              ~ network                 = "https://www.googleapis.com/compute/v1/projects/PROJECT-HERE/global/networks/tf-test-my-networkhn1qw8q3mr" -> "projects/PROJECT-HERE/global/networks/tf-test-my-networkhn1qw8q3mr"
              ~ no_automate_dns_zone    = false -> true # forces replacement
              ~ psc_connection_id       = "61488295387096170" -> (known after apply)
              + psc_connection_status   = (known after apply)
              ~ self_link               = "https://www.googleapis.com/compute/v1/projects/PROJECT-HERE/global/forwardingRules/globalrulehn1qw8q3mr" -> (known after apply)
                # (2 unchanged attributes hidden)
            }
        
        Plan: 1 to add, 0 to change, 1 to destroy.

TestAccComputeForwardingRule_forwardingRuleVpcPscExample and TestAccComputeForwardingRule_forwardingRuleVpcPscExampleUpdate are the same.

It might be worth running acceptance tests with TF_LOG=DEBUG so you can track the API calls. Are you able to run the acceptance tests locally?

@diogoEsteves42
Copy link
Contributor Author

diogoEsteves42 commented Jun 9, 2023

Hi @SarahFrench , thanks for the info. Yes, I can run the tests locally, great I'll use and save the logs with env_var.

@modular-magician modular-magician added awaiting-approval Pull requests that needs reviewer's approval to run presubmit tests and removed awaiting-approval Pull requests that needs reviewer's approval to run presubmit tests labels Jun 9, 2023
@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.

Terraform GA: Diff ( 5 files changed, 326 insertions(+))
Terraform Beta: Diff ( 6 files changed, 394 insertions(+))
TF Conversion: Diff ( 4 files changed, 23 insertions(+), 3 deletions(-))
TF OiCS: Diff ( 4 files changed, 196 insertions(+))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 2786
Passed tests 2486
Skipped tests: 295
Affected tests: 5

Action taken

Found 5 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
TestAccComputeNetworkEndpoints_networkEndpointsBasic|TestAccComputeGlobalForwardingRule_privateServiceConnectGoogleApisNoAutomateDnsExample|TestAccComputeForwardingRule_forwardingRuleVpcPscNoAutomateDnsExample|TestAccComputeFirewallPolicyRule_multipleRules|TestAccApigeeKeystoresAliasesKeyCertFile_apigeeKeystoresAliasesKeyCertFileTestExample

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

Tests passed during RECORDING mode:
TestAccComputeNetworkEndpoints_networkEndpointsBasic[Debug log]
TestAccComputeGlobalForwardingRule_privateServiceConnectGoogleApisNoAutomateDnsExample[Debug log]
TestAccComputeForwardingRule_forwardingRuleVpcPscNoAutomateDnsExample[Debug log]
TestAccApigeeKeystoresAliasesKeyCertFile_apigeeKeystoresAliasesKeyCertFileTestExample[Debug log]

Tests failed during RECORDING mode:
TestAccComputeFirewallPolicyRule_multipleRules[Error message] [Debug log]

Please fix these to complete your PR
View the build log or the debug log for each test

@diogoEsteves42 diogoEsteves42 marked this pull request as ready for review June 15, 2023 19:16
@modular-magician modular-magician added the awaiting-approval Pull requests that needs reviewer's approval to run presubmit tests label Jun 15, 2023
@diogoEsteves42
Copy link
Contributor Author

diogoEsteves42 commented Jun 15, 2023

Hi @SarahFrench, I've made some updates in the field for both resources, tested the scenarios for beta and ga, both passed.

@SarahFrench SarahFrench removed the awaiting-approval Pull requests that needs reviewer's approval to run presubmit tests label Jun 16, 2023
@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.

Terraform GA: Diff ( 6 files changed, 319 insertions(+), 8 deletions(-))
Terraform Beta: Diff ( 6 files changed, 400 insertions(+), 18 deletions(-))
TF Conversion: Diff ( 4 files changed, 23 insertions(+), 3 deletions(-))
TF OiCS: Diff ( 4 files changed, 194 insertions(+))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 2796
Passed tests 2492
Skipped tests: 301
Affected tests: 3

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
TestAccComputeForwardingRule_forwardingRuleVpcPscNoAutomateDnsExample|TestAccComputeFirewallPolicyRule_multipleRules|TestAccComputeNetworkEndpoints_networkEndpointsBasic

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

Tests passed during RECORDING mode:
TestAccComputeForwardingRule_forwardingRuleVpcPscNoAutomateDnsExample[Debug log]
TestAccComputeNetworkEndpoints_networkEndpointsBasic[Debug log]

Tests failed during RECORDING mode:
TestAccComputeFirewallPolicyRule_multipleRules[Error message] [Debug log]

Please fix these to complete your PR
View the build log or the debug log for each test

Copy link
Collaborator

@SarahFrench SarahFrench left a comment

Choose a reason for hiding this comment

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

Sorry for the wait! I've left a comment as I'm unfamiliar with how this field behaves, and something about comments in the example file.

This is used in PSC consumer ForwardingRule to control whether it should try to auto-generate a DNS zone or not.
Non-PSC forwarding rules do not use this field.
send_empty_value: true
immutable: true
Copy link
Collaborator

Choose a reason for hiding this comment

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

I was looking at the docs for updating global forwarding rules and didn't see a note about being unable to update this field. What made you choose to set it as immutable here (and for the regional version of the resource)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@SarahFrench about this one, I see it as immutable because I can't update the field after it's created, the API show us it's possible to add the field in the body, but when trying to update I receive an error "Invalid value for field 'resource.noAutomateDnsZone': 'false'. Invalid field set in Private Service Connect Forwarding Rule. This field should not be set."
Another point, this field doesn't return on the GET, the reason I'm adding the ignore_read, another point in the doc of gcloud for forwarding rules update, there's no flag to update the field
https://cloud.google.com/sdk/gcloud/reference/compute/forwarding-rules/update.

But, I'm double checking with some Googler that works with this resource and will let you know.

Copy link
Collaborator

Choose a reason for hiding this comment

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

It's a shame that the docs don't reflect this field being unchangeable, though from what you described the decision to make this field immutable and ignored on read sounds correct.

I'm happy to approve this PR, though should we wait on what the Googler says?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @SarahFrench , thanks for the answers and the help.
While I was writing an answer to you I just received a message.
So the field can't be patched because it's just on creation time and unfortunately we don't have this information on the documentation, just figuring it out.

So I see we can move forward with the review
Thanks a lot

@modular-magician modular-magician added awaiting-approval Pull requests that needs reviewer's approval to run presubmit tests and removed awaiting-approval Pull requests that needs reviewer's approval to run presubmit tests labels Jun 22, 2023
@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.

Terraform GA: Diff ( 6 files changed, 310 insertions(+), 8 deletions(-))
Terraform Beta: Diff ( 6 files changed, 388 insertions(+), 18 deletions(-))
TF Conversion: Diff ( 4 files changed, 23 insertions(+), 3 deletions(-))
TF OiCS: Diff ( 4 files changed, 191 insertions(+))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 2834
Passed tests 2538
Skipped tests: 295
Affected tests: 1

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
TestAccComputeFirewallPolicyRule_multipleRules

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

Tests failed during RECORDING mode:
TestAccComputeFirewallPolicyRule_multipleRules[Error message] [Debug log]

Please fix these to complete your PR
View the build log or the debug log for each test

@SarahFrench SarahFrench merged commit f8d6d26 into GoogleCloudPlatform:main Jul 3, 2023
ericayyliu pushed a commit to ericayyliu/magic-modules that referenced this pull request Jul 26, 2023
…oudPlatform#8102)

* adding the new fields noAutomateDnsZone, need to validate the error with test step and the plan was not empty

* adding the tests scenarios, need to fix the test for global

* adding more tests, but requires a test with a no_autome_dns with true value

* added to the field, immutability and ignoring read from api, tests are passing

* removing comments from tests
wj-chen pushed a commit to wj-chen/magic-modules that referenced this pull request Aug 1, 2023
…oudPlatform#8102)

* adding the new fields noAutomateDnsZone, need to validate the error with test step and the plan was not empty

* adding the tests scenarios, need to fix the test for global

* adding more tests, but requires a test with a no_autome_dns with true value

* added to the field, immutability and ignoring read from api, tests are passing

* removing comments from tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants