Resolve SNS topic ARNs via STS + SNS.GetTopicAttributes before using SNS.CreateTopic#2077
Merged
Merged
Conversation
…pic, with retries, caching, and a shared get_topic_arn path
…SNS topic ARN without requiring CreateTopic when lookup succeeds
… when matching “does not exist” / “could not be found”
…-aiobotocore sts typing
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2077 +/- ##
==========================================
- Coverage 73.91% 73.77% -0.14%
==========================================
Files 53 53
Lines 8112 8222 +110
==========================================
+ Hits 5996 6066 +70
- Misses 2116 2156 +40 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…and document it in options, README, and examples
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Publishing through the AWS SNS+SQS transport no longer assumes
sns:CreateTopicis available. The transport first tries to resolve the topic ARN by callingsts:GetCallerIdentity(for the account ID) andsns:GetTopicAttributeson the constructed ARN, caches the result, and only then falls back to the existingsns:CreateTopicpath (including topic attributes) when lookup does not find a topic.Why
Deployments that cannot grant
sns:CreateTopicbut can publish to an already-provisioned topic (with typical STS identity and SNS read permissions) should be able to publish without failing on create topic.Added Option
Options now include
aws_endpoint_urls.stsfor configuring the AWS STS endpoint (for example with Localstack).If a custom endpoint is set for
aws_endpoint_urls.snsbut not foraws_endpoint_urls.sts, the STS client falls back to the SNS endpoint URL for backward compatibility with existing configurations.Implementation notes
get_topic_arn,_lookup_topic_arn_via_sts_and_sns, and_sns_client_error_indicates_missing_topic(handles missing-topicClientErrorshapes).create_topicso concurrent callers stay consistent with cachedcls.topics.Noneso publish can still attemptcreate_topicwhen permitted.create_client("sts", …)is wired in the SNS+SQS transport and inClientConnectoroverloads for typed STS usage.types-aiobotocoreextras includests; lockfile picks uptypes-aiobotocore-stsand related resolution changes.Python 3.9 deprecation
Dropped support for Python 3.9.