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

Marked customer_name field as optional for interconnect resource #11640

Merged

Conversation

abhijeetkjha-google
Copy link
Contributor

@abhijeetkjha-google abhijeetkjha-google commented Sep 5, 2024

compute: marked `customer_name` and `location` fields as optional in `google_compute_interconnect` resource to support cross cloud interconnect

Bug Fix: hashicorp/terraform-provider-google#18264
The proto which defines the interconnect resource has customer_name field as an optional, so we should be providing this same parity between the terraform and the provided api. For Cross cloud interconnect, We should not be providing customer_name, else error is being thrown.

Copy link

github-actions bot commented Sep 5, 2024

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

@shuyama1, 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 modular-magician added awaiting-approval Pull requests that needs reviewer's approval to run presubmit tests service/compute-interconnect and removed awaiting-approval Pull requests that needs reviewer's approval to run presubmit tests labels Sep 5, 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 ( 2 files changed, 12 insertions(+), 13 deletions(-))
google-beta provider: Diff ( 2 files changed, 12 insertions(+), 13 deletions(-))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 993
Passed tests: 915
Skipped tests: 78
Affected tests: 0

Click here to see the affected service packages
  • compute

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

View the build log

@@ -2,7 +2,6 @@ data "google_project" "project" {}

Copy link
Member

Choose a reason for hiding this comment

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

Looks like this example is skipped from test generation. It will update the examples in the web documentation though. Would you mind also removing the field from this example to have a test coverage on this. Plus, can you also remove this line https://github.com/abhijeetkjha-google/magic-modules/blob/bugFix-361094483/mmv1/products/compute/Interconnect.yaml#L52, given the field is removed from the example. Thanks

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Would you mind also removing the field from this example to have a test coverage on this.

Since we are marking a field as optional wouldn't it be a good idea to have one test example with the field and another without the field. The compute_interconnect_basic.tf.erb contains the required field only and compute_interconnect_basic_test.tf.erb includes the optional field as well.

can you also remove this line https://github.com/abhijeetkjha-google/magic-modules/blob/bugFix-361094483/mmv1/products/compute/Interconnect.yaml#L52, given the field is removed from the example.

Sure, Done.

Copy link
Member

Choose a reason for hiding this comment

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

Would you mind also removing the field from this example to have a test coverage on this.

Since we are marking a field as optional wouldn't it be a good idea to have one test example with the field and another without the field. The compute_interconnect_basic.tf.erb contains the required field only and compute_interconnect_basic_test.tf.erb includes the optional field as well.

Oh, right, it makes sense to have the field included in at least one test. But it looks like compute_interconnect_basic.tf.erb is only used to generate the doc instead of tests, as indicated by the flag skip_test for the example. Are you able to test it locally and make sure the field is not required for resource creation?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes yes, I have verified that customer_name is an optional field and is not required for resource creation.

@modular-magician modular-magician added the awaiting-approval Pull requests that needs reviewer's approval to run presubmit tests label Sep 6, 2024
@harshithpatte-g
Copy link
Contributor

harshithpatte-g commented Sep 9, 2024

@abhijeetkjha-google Please update the release note.
Otherwise, LGTM.

@abhijeetkjha-google
Copy link
Contributor Author

@abhijeetkjha-google Please update the release note. Otherwise, LGTM.

Done.

@modular-magician modular-magician removed the awaiting-approval Pull requests that needs reviewer's approval to run presubmit tests label Sep 9, 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 ( 2 files changed, 12 insertions(+), 13 deletions(-))
google-beta provider: Diff ( 2 files changed, 12 insertions(+), 13 deletions(-))

@shuyama1
Copy link
Member

shuyama1 commented Sep 9, 2024

I've changed the change type from bug to enhancement in the release note as I think it's more accurate.

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 997
Passed tests: 921
Skipped tests: 76
Affected tests: 0

Click here to see the affected service packages
  • compute

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

View the build log

Copy link
Member

@shuyama1 shuyama1 left a comment

Choose a reason for hiding this comment

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

I've removed customer_name from the test case and run tests in a test PR #11668. Looks like the test failed with API error googleapi: Error 400: Required field 'resource.customerName' not specified, required. I wonder if the field is still required?

@abhijeetkjha-google
Copy link
Contributor Author

abhijeetkjha-google commented Sep 10, 2024

I've removed customer_name from the test case and run tests in a test PR #11668. Looks like the test failed with API error googleapi: Error 400: Required field 'resource.customerName' not specified, required. I wonder if the field is still required?

The error is rightly thrown, So I investigated this. So this is the issue.

We have three interconnects: Dedicated, Partner and Cross cloud.
So out of these three, Dedicated and Partner Interconnect requires customer_name as a field to create interconnect resource. And for Cross cloud interconnect we do no pass the customer_name else we will throw an error, incase a customer_name is detected.

without this change, If a person creates an cross cloud interconnect resource, They have to pass the customer_name field as its marked "required" for now but this will throw an error stating ""Customer name should not be present for Cross Cloud Interconnect".

So the test which are failing are for dedicated interconnect, which was a miss. So thats why we are getting this error.
So what I propose is that we should mark "customer_name" field as optional and not make any changes in these existing test. Instead I will try to write some test for "cross cloud interconnect" scenario.

@modular-magician modular-magician added the awaiting-approval Pull requests that needs reviewer's approval to run presubmit tests label Sep 13, 2024
Copy link

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

@modular-magician modular-magician removed the awaiting-approval Pull requests that needs reviewer's approval to run presubmit tests label Sep 16, 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, 54 insertions(+), 12 deletions(-))
google-beta provider: Diff ( 3 files changed, 54 insertions(+), 12 deletions(-))
Open in Cloud Shell: Diff ( 4 files changed, 113 insertions(+))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 1005
Passed tests: 929
Skipped tests: 74
Affected tests: 2

Click here to see the affected service packages
  • compute

Action taken

Found 2 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
  • TestAccComputeInstance_confidentialHyperDiskBootDisk
  • TestAccComputeInterconnect_computeInterconnectCrossCloudBasicExample

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

$\textcolor{red}{\textsf{Tests failed during RECORDING mode:}}$
TestAccComputeInstance_confidentialHyperDiskBootDisk[Error message] [Debug log]
TestAccComputeInterconnect_computeInterconnectCrossCloudBasicExample[Error message] [Debug log]

$\textcolor{red}{\textsf{Errors occurred during RECORDING mode. Please fix them to complete your PR.}}$

View the build log or the debug log for each test

Copy link
Member

@shuyama1 shuyama1 left a comment

Choose a reason for hiding this comment

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

TestAccComputeInterconnect_computeInterconnectCrossCloudBasicExample failed with

resource_compute_interconnect_generated_test.go:85: Step 1/2 error: Error running pre-apply refresh: exit status 1
        
        Error: Missing required argument
        
          on terraform_plugin_test.tf line 4, in resource "google_compute_interconnect" "example-interconnect":
           4: resource "google_compute_interconnect" "example-interconnect" {
        
        The argument "location" is required, but no definition was found.

@modular-magician modular-magician added the awaiting-approval Pull requests that needs reviewer's approval to run presubmit tests label Sep 19, 2024
@abhijeetkjha-google
Copy link
Contributor Author

Hi @shuyama1,
I tried adding/updating create tests, But it keeps failing as we can't use z2z location which are the locations available for testing. Also we need to add remote_location field which identifies this request as a cross_cloud instance. But as per the implementation we can't have location field in such cases so marking this field as optional as well. Since I am not able to add any function test around this scenario till we get some sort of test remote_location. I have updated this pr just with the field change. Let me know if anything can be done around this. Thanks.

@modular-magician modular-magician removed the awaiting-approval Pull requests that needs reviewer's approval to run presubmit tests label Sep 23, 2024
Copy link
Member

@shuyama1 shuyama1 left a comment

Choose a reason for hiding this comment

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

Would you be able to set up a local environment and test it locally? We may rely on local testing in this case if our testing environment is not compatible with feature. Thank you! https://googlecloudplatform.github.io/magic-modules/develop/test/run-tests/#run-tests

@@ -89,7 +89,6 @@ properties:
URL of the InterconnectLocation object that represents where this connection is to be provisioned.
resource: 'InterconnectLocations'
imports: 'selfLink'
required: true
Copy link
Member

Choose a reason for hiding this comment

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

Is making location optional in this resource intended? Sorry, I'm not fully understand what remote_location field is. Is location field not needed for resource creation in some cases?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, Incase of cross_cloud interconnect we don't need to specify location field as location field implies for google owned location, Incase of cross_cloud interconnect we have to replace it with remote_location field.

Copy link
Member

Choose a reason for hiding this comment

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

Got it. Would you mind also clarifying it in the description of the field? Thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@@ -145,7 +144,6 @@ properties:
Customer name, to put in the Letter of Authorization as the party authorized to request a
crossconnect.
immutable: true
required: true
Copy link
Member

Choose a reason for hiding this comment

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

Could you please update the description of this field to clarify when this field is required and when it is not? Thanks

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@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 ( 2 files changed, 23 insertions(+), 23 deletions(-))
google-beta provider: Diff ( 2 files changed, 23 insertions(+), 23 deletions(-))

@modular-magician modular-magician added the awaiting-approval Pull requests that needs reviewer's approval to run presubmit tests label Sep 23, 2024
@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 1011
Passed tests: 937
Skipped tests: 74
Affected tests: 0

Click here to see the affected service packages
  • compute

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

View the build log

Copy link
Member

@shuyama1 shuyama1 left a comment

Choose a reason for hiding this comment

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

left a small comment in #11640 (comment) regarding a documentation improvement. Thanks!

@abhijeetkjha-google
Copy link
Contributor Author

left a small comment in #11640 (comment) regarding a documentation improvement. Thanks!

Updated the description. Thanks.

@modular-magician modular-magician removed the awaiting-approval Pull requests that needs reviewer's approval to run presubmit tests label Sep 24, 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 ( 2 files changed, 27 insertions(+), 23 deletions(-))
google-beta provider: Diff ( 2 files changed, 27 insertions(+), 23 deletions(-))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 1015
Passed tests: 941
Skipped tests: 74
Affected tests: 0

Click here to see the affected service packages
  • compute

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

View the build log

Copy link
Member

@shuyama1 shuyama1 left a comment

Choose a reason for hiding this comment

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

The contributor has confirmed the changes work as expected with local testing.

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.

customer_name should not required when creating Cross Cloud Interconnect (CCI).
4 participants