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

aws_launch_template: fix network interface device_index of 0 being ignored #23767

Merged

Conversation

fcheung
Copy link
Contributor

@fcheung fcheung commented Mar 19, 2022

0 is a legal device index, moreover a launchtemplate requires a network interface with a device index of 0 to be functional

Community Note

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

Closes #23766

Output from acceptance testing:

$make testacc TESTS=TestAccEC2LaunchTemplate_networkInterface PKG=ec2 

==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/ec2/... -v -count 1 -parallel 20 -run='TestAccEC2LaunchTemplate_networkInterface'  -timeout 180m
=== RUN   TestAccEC2LaunchTemplate_networkInterface
=== PAUSE TestAccEC2LaunchTemplate_networkInterface
=== RUN   TestAccEC2LaunchTemplate_networkInterfaceAddresses
=== PAUSE TestAccEC2LaunchTemplate_networkInterfaceAddresses
=== RUN   TestAccEC2LaunchTemplate_networkInterfaceType
=== PAUSE TestAccEC2LaunchTemplate_networkInterfaceType
=== RUN   TestAccEC2LaunchTemplate_networkInterfaceCardIndex
=== PAUSE TestAccEC2LaunchTemplate_networkInterfaceCardIndex
=== RUN   TestAccEC2LaunchTemplate_networkInterfaceIPv4PrefixCount
=== PAUSE TestAccEC2LaunchTemplate_networkInterfaceIPv4PrefixCount
=== RUN   TestAccEC2LaunchTemplate_networkInterfaceIPv4Prefixes
=== PAUSE TestAccEC2LaunchTemplate_networkInterfaceIPv4Prefixes
=== RUN   TestAccEC2LaunchTemplate_networkInterfaceIPv6PrefixCount
=== PAUSE TestAccEC2LaunchTemplate_networkInterfaceIPv6PrefixCount
=== RUN   TestAccEC2LaunchTemplate_networkInterfaceIPv6Prefixes
=== PAUSE TestAccEC2LaunchTemplate_networkInterfaceIPv6Prefixes
=== CONT  TestAccEC2LaunchTemplate_networkInterface
=== CONT  TestAccEC2LaunchTemplate_networkInterfaceIPv4PrefixCount
=== CONT  TestAccEC2LaunchTemplate_networkInterfaceIPv6PrefixCount
=== CONT  TestAccEC2LaunchTemplate_networkInterfaceIPv6Prefixes
=== CONT  TestAccEC2LaunchTemplate_networkInterfaceAddresses
=== CONT  TestAccEC2LaunchTemplate_networkInterfaceIPv4Prefixes
=== CONT  TestAccEC2LaunchTemplate_networkInterfaceType
=== CONT  TestAccEC2LaunchTemplate_networkInterfaceCardIndex
--- PASS: TestAccEC2LaunchTemplate_networkInterfaceType (18.13s)
--- PASS: TestAccEC2LaunchTemplate_networkInterfaceCardIndex (18.83s)
--- PASS: TestAccEC2LaunchTemplate_networkInterfaceIPv4Prefixes (19.00s)
--- PASS: TestAccEC2LaunchTemplate_networkInterfaceIPv6Prefixes (19.14s)
--- PASS: TestAccEC2LaunchTemplate_networkInterfaceIPv6PrefixCount (19.14s)
--- PASS: TestAccEC2LaunchTemplate_networkInterfaceIPv4PrefixCount (19.50s)
--- PASS: TestAccEC2LaunchTemplate_networkInterfaceAddresses (24.70s)
--- PASS: TestAccEC2LaunchTemplate_networkInterface (24.71s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/ec2	27.604s

I tried to write a failing test (adding resource.TestCheckResourceAttr(resourceName, "network_interfaces.0.device_index", "0")) but that test seemed to pass even without the change in this pr

0 is a legal device index, moreover a launchtemplate requires a network interface with a device index of 0 to be functional
@github-actions github-actions bot added size/XS Managed by automation to categorize the size of a PR. needs-triage Waiting for first response or review from a maintainer. service/ec2 Issues and PRs that pertain to the ec2 service. labels Mar 19, 2022
@github-actions github-actions bot added the tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. label Mar 19, 2022
@fcheung fcheung changed the title Fix device_index of 0 being ignored aws_launch_template: fix network interface device_index of 0 being ignored Mar 19, 2022
Copy link
Member

@bschaatsbergen bschaatsbergen left a comment

Choose a reason for hiding this comment

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

LGTM

@ewbankkit ewbankkit added bug Addresses a defect in current functionality. regression Pertains to a degraded workflow resulting from an upstream patch or internal enhancement. and removed needs-triage Waiting for first response or review from a maintainer. labels Mar 21, 2022
Copy link
Contributor

@ewbankkit ewbankkit left a comment

Choose a reason for hiding this comment

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

LGTM 🚀.

% make testacc TESTS=TestAccEC2LaunchTemplate_networkInterface PKG=ec2 ACCTEST_PARALLELISM=2
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/ec2/... -v -count 1 -parallel 2 -run='TestAccEC2LaunchTemplate_networkInterface'  -timeout 180m
=== RUN   TestAccEC2LaunchTemplate_networkInterface
=== PAUSE TestAccEC2LaunchTemplate_networkInterface
=== RUN   TestAccEC2LaunchTemplate_networkInterfaceAddresses
=== PAUSE TestAccEC2LaunchTemplate_networkInterfaceAddresses
=== RUN   TestAccEC2LaunchTemplate_networkInterfaceType
=== PAUSE TestAccEC2LaunchTemplate_networkInterfaceType
=== RUN   TestAccEC2LaunchTemplate_networkInterfaceCardIndex
=== PAUSE TestAccEC2LaunchTemplate_networkInterfaceCardIndex
=== RUN   TestAccEC2LaunchTemplate_networkInterfaceIPv4PrefixCount
=== PAUSE TestAccEC2LaunchTemplate_networkInterfaceIPv4PrefixCount
=== RUN   TestAccEC2LaunchTemplate_networkInterfaceIPv4Prefixes
=== PAUSE TestAccEC2LaunchTemplate_networkInterfaceIPv4Prefixes
=== RUN   TestAccEC2LaunchTemplate_networkInterfaceIPv6PrefixCount
=== PAUSE TestAccEC2LaunchTemplate_networkInterfaceIPv6PrefixCount
=== RUN   TestAccEC2LaunchTemplate_networkInterfaceIPv6Prefixes
=== PAUSE TestAccEC2LaunchTemplate_networkInterfaceIPv6Prefixes
=== CONT  TestAccEC2LaunchTemplate_networkInterface
=== CONT  TestAccEC2LaunchTemplate_networkInterfaceIPv4PrefixCount
--- PASS: TestAccEC2LaunchTemplate_networkInterfaceIPv4PrefixCount (15.70s)
=== CONT  TestAccEC2LaunchTemplate_networkInterfaceType
--- PASS: TestAccEC2LaunchTemplate_networkInterface (22.27s)
=== CONT  TestAccEC2LaunchTemplate_networkInterfaceCardIndex
--- PASS: TestAccEC2LaunchTemplate_networkInterfaceType (14.14s)
=== CONT  TestAccEC2LaunchTemplate_networkInterfaceIPv6PrefixCount
--- PASS: TestAccEC2LaunchTemplate_networkInterfaceCardIndex (15.17s)
=== CONT  TestAccEC2LaunchTemplate_networkInterfaceIPv6Prefixes
--- PASS: TestAccEC2LaunchTemplate_networkInterfaceIPv6PrefixCount (14.61s)
=== CONT  TestAccEC2LaunchTemplate_networkInterfaceIPv4Prefixes
--- PASS: TestAccEC2LaunchTemplate_networkInterfaceIPv6Prefixes (14.60s)
=== CONT  TestAccEC2LaunchTemplate_networkInterfaceAddresses
--- PASS: TestAccEC2LaunchTemplate_networkInterfaceIPv4Prefixes (14.78s)
--- PASS: TestAccEC2LaunchTemplate_networkInterfaceAddresses (22.32s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/ec2	78.226s

@ewbankkit
Copy link
Contributor

@fcheung Thanks for the contribution 🎉 👏 and sorry that you hit this problem.
I tweaked your PR a bit by adding the same logic for network_card_index and adding verification of all network_interfaces attributes to the acceptance test case.

@ewbankkit ewbankkit merged commit e2252fd into hashicorp:main Mar 21, 2022
@github-actions github-actions bot added this to the v4.7.0 milestone Mar 21, 2022
@stylianosrigas
Copy link

@ewbankkit Do you have an estimated time for the v4.7.0 release that fixes the launch template issues?

@ewbankkit
Copy link
Contributor

We usually release on Thursdays.

@github-actions
Copy link

This functionality has been released in v4.7.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

github-actions bot commented May 6, 2022

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 May 6, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. regression Pertains to a degraded workflow resulting from an upstream patch or internal enhancement. service/ec2 Issues and PRs that pertain to the ec2 service. size/XS 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_launch_template no longer setting device_index=0 on network_interface
4 participants