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

f/aws vpc network interface attachment import #27364

Merged

Conversation

yfauser
Copy link
Contributor

@yfauser yfauser commented Oct 20, 2022

Description

This PR adds import capabilities to network interface attachments.

  • Added importer to the schema
  • Changed the read function to be able to import the network_interface_id, which is a required argument that was not originally included in the read function
  • Added a new helper function to find.go to return the full interface instead of just the attachment as used in the original read function
  • Added documentation

Relations

Closes #26655

Additional Notes

The original read function did not return the NetworkInterfaceId, which is a required attribute. So, I had to change the read function to accommodate for this.

I saw to possible solutions to get the network_interface_id value into the read function:

  1. Change the existing FindNetworkInterfaceAttachmentByID helper function to return the NetworkInterfaceId together with the Attachment object, or
  2. Create a new function that returns the full NetworkInterface instead of only the attachment.

I went for the second option as it felt safer. There was only one other caller that I identified using FindNetworkInterfaceAttachmentByID, but still I found approach 2 better than changing the return value structure

Output from Acceptance Testing

$ make testacc TESTS=TestAccVPCNetworkInterfaceAttachment PKG=ec2
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/ec2/... -v -count 1 -parallel 20 -run='TestAccVPCNetworkInterfaceAttachment'  -timeout 180m
=== RUN   TestAccVPCNetworkInterfaceAttachment_basic
=== PAUSE TestAccVPCNetworkInterfaceAttachment_basic
=== CONT  TestAccVPCNetworkInterfaceAttachment_basic
--- PASS: TestAccVPCNetworkInterfaceAttachment_basic (326.87s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/ec2        329.518s

Yves Fauser and others added 3 commits October 20, 2022 10:18
… resource

- Changed  read function to also read the network_interface_id as it is required for the import
- Added func to find.go in ec2 pkg that finds interface based on Attachement Id
- Changed test steps to include import validation
@github-actions
Copy link

Community Note

Voting for Prioritization

  • Please vote on this pull request by adding a 👍 reaction to the original post to help the community and maintainers prioritize this pull request.
  • Please see our prioritization guide for information on how we prioritize.
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.

For Submitters

  • Review the contribution guide relating to the type of change you are making to ensure all of the necessary steps have been taken.
  • For new resources and data sources, use skaff to generate scaffolding with comments detailing common expectations.
  • Whether or not the branch has been rebased will not impact prioritization, but doing so is always a welcome surprise.

@github-actions github-actions bot added needs-triage Waiting for first response or review from a maintainer. documentation Introduces or discusses updates to documentation. service/vpc Issues and PRs that pertain to the vpc service. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. size/S Managed by automation to categorize the size of a PR. labels Oct 20, 2022
@yfauser yfauser marked this pull request as ready for review October 20, 2022 19:23
@yfauser yfauser changed the title [WIP] f/aws vpc network interface attachment import f/aws vpc network interface attachment import Oct 20, 2022
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Welcome @yfauser 👋

It looks like this is your first Pull Request submission to the Terraform AWS Provider! If you haven’t already done so please make sure you have checked out our CONTRIBUTOR guide and FAQ to make sure your contribution is adhering to best practice and has all the necessary elements in place for a successful approval.

Also take a look at our FAQ which details how we prioritize Pull Requests for inclusion.

Thanks again, and welcome to the community! 😃

Copy link
Contributor

@ddericco ddericco left a comment

Choose a reason for hiding this comment

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

LGTME - thanks for the PR @yfauser!

@ewbankkit ewbankkit added enhancement Requests to existing resources that expand the functionality or scope. and removed needs-triage Waiting for first response or review from a maintainer. labels Oct 20, 2022
@gdavison gdavison self-assigned this Oct 20, 2022
Copy link
Contributor

@gdavison gdavison left a comment

Choose a reason for hiding this comment

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

Looks good! 🚀

--- PASS: TestAccVPCNetworkInterfaceAttachment_basic (271.81s)

@gdavison gdavison merged commit 246a7d8 into hashicorp:main Oct 21, 2022
@github-actions github-actions bot added this to the v4.37.0 milestone Oct 21, 2022
@github-actions
Copy link

This functionality has been released in v4.37.0 of the Terraform AWS Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

@github-actions
Copy link

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 27, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Introduces or discusses updates to documentation. enhancement Requests to existing resources that expand the functionality or scope. service/vpc Issues and PRs that pertain to the vpc service. size/S Managed by automation to categorize the size of a PR. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

aws_network_interface_attachment: Add import functionality
4 participants