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

r/aws_sns_topic_subscription: don't set the FilterPolicyScope attribute in unsupported partitions #28253

Merged

Conversation

roberth-k
Copy link
Contributor

Description

Prevents the aws_sns_topic_subscription resource from passing the FilterPolicyScope attribute unless it's been set explicitly by the practitioner or read back from the API first. This should fix a change introduced in #28004 that broke subscriptions in AWS China partitions.

I don't have access to the partition where the issue occurs, so this fix is speculative. I ran manual tests to simulate the behaviour of the AWS China partition by unsetting the FilterPolicyScope attribute during reads, and checking whether the provider in those cases would attempt to write back the policy scope attribute.

Also increases the confirmation timeout of the TestAccSNSTopicSubscription_autoConfirmingSecuredEndpoint acceptance test -- at the default value of 1 minute, the test was a bit too flaky.

Relations

Relates #28004
Closes #28094

References

Output from Acceptance Testing

$ make testacc TESTS=TestAccSNSTopicSubscription_ PKG=sns
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/sns/... -v -count 1 -parallel 20 -run='TestAccSNSTopicSubscription_'  -timeout 180m
=== RUN   TestAccSNSTopicSubscription_basic
=== PAUSE TestAccSNSTopicSubscription_basic
=== RUN   TestAccSNSTopicSubscription_filterPolicy
=== PAUSE TestAccSNSTopicSubscription_filterPolicy
=== RUN   TestAccSNSTopicSubscription_filterPolicyScope
=== PAUSE TestAccSNSTopicSubscription_filterPolicyScope
=== RUN   TestAccSNSTopicSubscription_filterPolicyScope_policyNotSet
=== PAUSE TestAccSNSTopicSubscription_filterPolicyScope_policyNotSet
=== RUN   TestAccSNSTopicSubscription_deliveryPolicy
=== PAUSE TestAccSNSTopicSubscription_deliveryPolicy
=== RUN   TestAccSNSTopicSubscription_redrivePolicy
=== PAUSE TestAccSNSTopicSubscription_redrivePolicy
=== RUN   TestAccSNSTopicSubscription_rawMessageDelivery
=== PAUSE TestAccSNSTopicSubscription_rawMessageDelivery
=== RUN   TestAccSNSTopicSubscription_autoConfirmingEndpoint
=== PAUSE TestAccSNSTopicSubscription_autoConfirmingEndpoint
=== RUN   TestAccSNSTopicSubscription_autoConfirmingSecuredEndpoint
=== PAUSE TestAccSNSTopicSubscription_autoConfirmingSecuredEndpoint
=== RUN   TestAccSNSTopicSubscription_email
=== PAUSE TestAccSNSTopicSubscription_email
=== RUN   TestAccSNSTopicSubscription_firehose
=== PAUSE TestAccSNSTopicSubscription_firehose
=== RUN   TestAccSNSTopicSubscription_disappears
=== PAUSE TestAccSNSTopicSubscription_disappears
=== RUN   TestAccSNSTopicSubscription_Disappears_topic
=== PAUSE TestAccSNSTopicSubscription_Disappears_topic
=== CONT  TestAccSNSTopicSubscription_basic
=== CONT  TestAccSNSTopicSubscription_deliveryPolicy
=== CONT  TestAccSNSTopicSubscription_filterPolicyScope
=== CONT  TestAccSNSTopicSubscription_filterPolicy
=== CONT  TestAccSNSTopicSubscription_filterPolicyScope_policyNotSet
=== CONT  TestAccSNSTopicSubscription_redrivePolicy
=== CONT  TestAccSNSTopicSubscription_rawMessageDelivery
=== CONT  TestAccSNSTopicSubscription_autoConfirmingEndpoint
=== CONT  TestAccSNSTopicSubscription_Disappears_topic
=== CONT  TestAccSNSTopicSubscription_disappears
=== CONT  TestAccSNSTopicSubscription_firehose
=== CONT  TestAccSNSTopicSubscription_email
=== CONT  TestAccSNSTopicSubscription_autoConfirmingSecuredEndpoint
--- PASS: TestAccSNSTopicSubscription_filterPolicyScope_policyNotSet (3.44s)
--- PASS: TestAccSNSTopicSubscription_email (13.04s)
--- PASS: TestAccSNSTopicSubscription_autoConfirmingEndpoint (88.98s)
--- PASS: TestAccSNSTopicSubscription_rawMessageDelivery (91.76s)
--- PASS: TestAccSNSTopicSubscription_filterPolicy (92.09s)
--- PASS: TestAccSNSTopicSubscription_deliveryPolicy (92.34s)
--- PASS: TestAccSNSTopicSubscription_Disappears_topic (96.59s)
--- PASS: TestAccSNSTopicSubscription_basic (98.75s)
--- PASS: TestAccSNSTopicSubscription_disappears (103.20s)
--- PASS: TestAccSNSTopicSubscription_filterPolicyScope (137.91s)
--- PASS: TestAccSNSTopicSubscription_redrivePolicy (141.52s)
--- PASS: TestAccSNSTopicSubscription_firehose (143.22s)
--- PASS: TestAccSNSTopicSubscription_autoConfirmingSecuredEndpoint (208.62s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/sns        210.647s

…icyScope unless a value has been read back from the API
…toConfirmingSecuredEndpoint acceptance test

At 1 minute, it was flaky.
@github-actions
Copy link

github-actions bot commented Dec 8, 2022

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/sns Issues and PRs that pertain to the sns service. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. needs-triage Waiting for first response or review from a maintainer. size/XS Managed by automation to categorize the size of a PR. and removed needs-triage Waiting for first response or review from a maintainer. labels Dec 8, 2022
@ewbankkit ewbankkit added the bug Addresses a defect in current functionality. label Dec 8, 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 🚀.

AWS US GovCloud
% make testacc TESTARGS='-run=TestAccSNSTopicSubscription_filterPolicy' PKG=sns ACCTEST_PARALLELISM=2
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/sns/... -v -count 1 -parallel 2  -run=TestAccSNSTopicSubscription_filterPolicy -timeout 180m
=== RUN   TestAccSNSTopicSubscription_filterPolicy
=== PAUSE TestAccSNSTopicSubscription_filterPolicy
=== RUN   TestAccSNSTopicSubscription_filterPolicyScope
=== PAUSE TestAccSNSTopicSubscription_filterPolicyScope
=== RUN   TestAccSNSTopicSubscription_filterPolicyScope_policyNotSet
=== PAUSE TestAccSNSTopicSubscription_filterPolicyScope_policyNotSet
=== CONT  TestAccSNSTopicSubscription_filterPolicy
=== CONT  TestAccSNSTopicSubscription_filterPolicyScope_policyNotSet
--- PASS: TestAccSNSTopicSubscription_filterPolicyScope_policyNotSet (2.60s)
=== CONT  TestAccSNSTopicSubscription_filterPolicyScope
--- PASS: TestAccSNSTopicSubscription_filterPolicy (95.55s)
--- PASS: TestAccSNSTopicSubscription_filterPolicyScope (141.30s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/sns	149.021s

@ewbankkit
Copy link
Contributor

@roberth-k Thanks for the contribution 🎉 👏.

@ewbankkit ewbankkit merged commit 0bcdcfa into hashicorp:main Dec 8, 2022
@github-actions github-actions bot added this to the v4.46.0 milestone Dec 8, 2022
@github-actions
Copy link

github-actions bot commented Dec 8, 2022

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

@cwadley
Copy link

cwadley commented Dec 9, 2022

Excellent work, confirmed working in AWS China. 💯

@github-actions
Copy link

github-actions bot commented Jan 9, 2023

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 Jan 9, 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/sns Issues and PRs that pertain to the sns 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.

[Bug]:
3 participants