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

Fix: Principal allowed returned multiple when expecting one #30974

Merged
merged 5 commits into from
Apr 26, 2023

Conversation

robh007
Copy link
Contributor

@robh007 robh007 commented Apr 25, 2023

Description

A change was made to vpc_endpoint_service_allowed #27640 which introduced tfresource.AssertSingleResult however the results returned from the call to FindVPCEndpointServicePermissions didn't filter the result & anything above 1 allowed principal resulted in an error. I've also added an additional test which adds two service principals to be allowed access to the endpoint.

Relations

Closes #30873.
Relates #27640.

References

Output from Acceptance Testing

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

...

@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 service/vpc Issues and PRs that pertain to the vpc service. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. size/M Managed by automation to categorize the size of a PR. needs-triage Waiting for first response or review from a maintainer. labels Apr 25, 2023
@ewbankkit ewbankkit added bug Addresses a defect in current functionality. and removed needs-triage Waiting for first response or review from a maintainer. labels Apr 26, 2023
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 TESTARGS='-run=TestAccVPCEndpointServiceAllowedPrincipal_' 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=TestAccVPCEndpointServiceAllowedPrincipal_ -timeout 180m
=== RUN   TestAccVPCEndpointServiceAllowedPrincipal_basic
=== PAUSE TestAccVPCEndpointServiceAllowedPrincipal_basic
=== RUN   TestAccVPCEndpointServiceAllowedPrincipal_multiple
=== PAUSE TestAccVPCEndpointServiceAllowedPrincipal_multiple
=== RUN   TestAccVPCEndpointServiceAllowedPrincipal_tags
=== PAUSE TestAccVPCEndpointServiceAllowedPrincipal_tags
=== RUN   TestAccVPCEndpointServiceAllowedPrincipal_migrateID
=== PAUSE TestAccVPCEndpointServiceAllowedPrincipal_migrateID
=== RUN   TestAccVPCEndpointServiceAllowedPrincipal_migrateAndTag
=== PAUSE TestAccVPCEndpointServiceAllowedPrincipal_migrateAndTag
=== CONT  TestAccVPCEndpointServiceAllowedPrincipal_basic
=== CONT  TestAccVPCEndpointServiceAllowedPrincipal_migrateID
--- PASS: TestAccVPCEndpointServiceAllowedPrincipal_basic (236.85s)
=== CONT  TestAccVPCEndpointServiceAllowedPrincipal_migrateAndTag
--- PASS: TestAccVPCEndpointServiceAllowedPrincipal_migrateID (291.36s)
=== CONT  TestAccVPCEndpointServiceAllowedPrincipal_tags
--- PASS: TestAccVPCEndpointServiceAllowedPrincipal_tags (244.29s)
=== CONT  TestAccVPCEndpointServiceAllowedPrincipal_multiple
--- PASS: TestAccVPCEndpointServiceAllowedPrincipal_migrateAndTag (320.34s)
--- PASS: TestAccVPCEndpointServiceAllowedPrincipal_multiple (224.07s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/ec2	765.454s

@github-actions github-actions bot added size/L Managed by automation to categorize the size of a PR. and removed size/M Managed by automation to categorize the size of a PR. labels Apr 26, 2023
@ewbankkit
Copy link
Contributor

@robh007 Thanks for the contribution 🎉 👏.

I found that we have to do the principalARN filter client-side as we were getting errors like

An error occurred (InvalidFilter) when calling the DescribeVpcEndpointServicePermissions operation: The filter value arn:aws:iam::123456789012:role/terraform_team1_dev-developer contains unsupported characters

in our testing.

@ewbankkit ewbankkit merged commit 3667679 into hashicorp:main Apr 26, 2023
@github-actions github-actions bot added this to the v4.65.0 milestone Apr 26, 2023
@robh007 robh007 deleted the vpc-endpoint-fix branch April 26, 2023 22:04
@robh007
Copy link
Contributor Author

robh007 commented Apr 26, 2023

Thanks for fixing it up @ewbankkit , apologies if I caused additional work.

@github-actions
Copy link

This functionality has been released in v4.65.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 May 29, 2023
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. service/vpc Issues and PRs that pertain to the vpc service. size/L 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.

[Bug]: aws_vpc_endpoint_service_allowed_principal
2 participants