Skip to content

Add network attachment to gce instance#8829

Merged
trodge merged 29 commits into
GoogleCloudPlatform:mainfrom
maxi-cit:add-network-attchment-to-gce-instance
Sep 21, 2023
Merged

Add network attachment to gce instance#8829
trodge merged 29 commits into
GoogleCloudPlatform:mainfrom
maxi-cit:add-network-attchment-to-gce-instance

Conversation

@maxi-cit

@maxi-cit maxi-cit commented Aug 31, 2023

Copy link
Copy Markdown
Contributor

This PR enables support for network attachment at the gce instance network interfaces

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 Write release notes before writing my release note below.

Release Note Template for Downstream PRs (will be copied)

google_compute_instance

…nt-to-gce-instance

sync merge from upstream/main
…nt-to-gce-instance

sync merge from upstream/main
…nt-to-gce-instance

sync merge from upstream/main
@modular-magician

Copy link
Copy Markdown
Collaborator

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 modular-magician added the awaiting-approval Pull requests that need reviewer's approval to run presubmit tests label Aug 31, 2023
@maxi-cit maxi-cit marked this pull request as ready for review September 1, 2023 10:27
@modular-magician modular-magician removed the awaiting-approval Pull requests that need reviewer's approval to run presubmit tests label Sep 1, 2023
@modular-magician

Copy link
Copy Markdown
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 Beta: Diff ( 2 files changed, 285 insertions(+))

Missing test report

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

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

resource "google_compute_instance_from_machine_image" "primary" {
  network_interface {
    network_attachment = # value needed
  }
}

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

resource "google_compute_instance_from_template" "primary" {
  network_interface {
    network_attachment = # value needed
  }
}

@modular-magician

Copy link
Copy Markdown
Collaborator

Tests analytics

Total tests: 3010
Passed tests 2712
Skipped tests: 296
Affected tests: 2

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_networkAttachmentUpdate|TestAccComputeInstance_NetworkAttachment

Get to know how VCR tests work

@modular-magician

Copy link
Copy Markdown
Collaborator

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

…nt-to-gce-instance

sync merge from upstream/main
@trodge

trodge commented Sep 5, 2023

Copy link
Copy Markdown
Contributor

Tests are failing with the following error:

2023-09-02T00:21:13.173Z [ERROR] sdk.proto: Response contains error diagnostic: tf_provider_addr=registry.terraform.io/hashicorp/google tf_proto_version=5.3 diagnostic_detail="" diagnostic_severity=ERROR diagnostic_summary="Error creating instance: googleapi: Error 400: Invalid value for field 'resource.networkInterfaces[1]': '{  \"networkAttachment\": \"https://www.googleapis.com/compute/beta/projects/ci-test-project-188019/reg...'. Instance must be in the same region as the network attachment., invalid" tf_rpc=ApplyResourceChange tf_resource_type=google_compute_instance tf_req_id=1bac79aa-4c87-e3ed-6d10-8018caf72a57

Comment thread mmv1/third_party/terraform/services/compute/resource_compute_instance_test.go.erb Outdated
Comment thread mmv1/third_party/terraform/services/compute/resource_compute_instance_test.go.erb Outdated
@modular-magician modular-magician added the awaiting-approval Pull requests that need reviewer's approval to run presubmit tests label Sep 18, 2023
@modular-magician modular-magician removed the awaiting-approval Pull requests that need reviewer's approval to run presubmit tests label Sep 19, 2023
@modular-magician

Copy link
Copy Markdown
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 ( 1 file changed, 11 insertions(+), 8 deletions(-))
Terraform Beta: Diff ( 3 files changed, 316 insertions(+), 8 deletions(-))

Missing test report

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

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

resource "google_compute_instance_from_machine_image" "primary" {
  network_interface {
    network_attachment = # value needed
  }
}

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

resource "google_compute_instance_from_template" "primary" {
  network_interface {
    network_attachment = # value needed
  }
}

@modular-magician

Copy link
Copy Markdown
Collaborator

Tests analytics

Total tests: 3072
Passed tests 2766
Skipped tests: 300
Affected tests: 6

Action taken

Found 6 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
TestAccBigQueryDataTable_bigtable|TestAccBigtableAppProfile_bigtableAppProfileAnyclusterExample|TestAccBigtableAppProfile_bigtableAppProfileSingleclusterExample|TestAccBigtableAppProfile_bigtableAppProfileMulticlusterExample|TestAccComputeInstance_networkAttachmentUpdate|TestAccComputeInstance_NetworkAttachment

Get to know how VCR tests work

@modular-magician

Copy link
Copy Markdown
Collaborator

$\textcolor{green}{\textsf{Tests passed during RECORDING mode:}}$
TestAccBigQueryDataTable_bigtable[Debug log]
TestAccBigtableAppProfile_bigtableAppProfileAnyclusterExample[Debug log]
TestAccBigtableAppProfile_bigtableAppProfileSingleclusterExample[Debug log]
TestAccBigtableAppProfile_bigtableAppProfileMulticlusterExample[Debug log]
TestAccComputeInstance_NetworkAttachment[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:}}$
TestAccComputeInstance_networkAttachmentUpdate[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 modular-magician added the awaiting-approval Pull requests that need reviewer's approval to run presubmit tests label Sep 20, 2023
@maxi-cit

Copy link
Copy Markdown
Contributor Author

Hello @trodge I updated the behavior of this field since this API is not able to update an interface's network attachment. This makes this field immutable and will require instance recreation
I also updated the related tests

@modular-magician modular-magician removed the awaiting-approval Pull requests that need reviewer's approval to run presubmit tests label Sep 20, 2023
@modular-magician

Copy link
Copy Markdown
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 ( 1 file changed, 11 insertions(+), 8 deletions(-))
Terraform Beta: Diff ( 4 files changed, 228 insertions(+), 17 deletions(-))
TF Conversion: Diff ( 1 file changed, 9 deletions(-))

Missing test report

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

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

resource "google_compute_instance_from_machine_image" "primary" {
  network_interface {
    network_attachment = # value needed
  }
}

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

resource "google_compute_instance_from_template" "primary" {
  network_interface {
    network_attachment = # value needed
  }
}

@modular-magician

Copy link
Copy Markdown
Collaborator

Tests analytics

Total tests: 3077
Passed tests 2777
Skipped tests: 299
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
TestAccComputeInstance_NetworkAttachmentUpdate

Get to know how VCR tests work

@modular-magician

Copy link
Copy Markdown
Collaborator

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

Rerun these tests in REPLAYING mode to catch issues

$\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

@trodge trodge merged commit a05ae4f into GoogleCloudPlatform:main Sep 21, 2023
nevzheng pushed a commit to nevzheng/magic-modules that referenced this pull request Sep 22, 2023
* first draft for new Network Attachment resource

* updated NetworkAttachment specification file

* added usage example for Network Attachment with GCE Instance

* verified attributes and descriptions

* enhanced network attachment examples

* adding network attachment field to compute instance network interface

* added network attachment specification to yaml file

* added integration tests

* fixing minor typo

* fixed typo

* fixed typo

* fixed tf config

* fixed typo

* fixed network attachment simple test

* updated instance resource documentation

* removed bad logic network attachment validation

* fixed tests and field specification for network attachment
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