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: sns topic creation should not be idempotent #3809

Merged
merged 2 commits into from
Apr 12, 2024
Merged

Conversation

corymhall
Copy link
Contributor

@corymhall corymhall commented Apr 11, 2024

This is a re-roll of #3235.

See this comment for why we are re-rolling this.

Previously the creation of an SNS topic was idempotent, so you could create multiple pulumi resources corresponding to the same SNS topic, causing confusing behaviour when one was deleted/replaced.

With this PR, trying to create a topic which exists will error.

Note that this is kind of a breaking change - pulumi programs where the same SNS topic was created through multiple pulumi resources would run fine before but will now error.

Note also the mutex around the listing and creating of SNS topics - this is needed to prevent race conditions within the same program. Race conditions with other programs are still possible and that is unavoidable because of the AWS API.

fixes #3288, fixes #2009.

Co-authored-by: VenelinMartinov [email protected]

This is a re-roll of #3235.

See this comment for why we are re-rolling this.

closes #3288

Co-authored-by: VenelinMartinov [email protected]
@corymhall
Copy link
Contributor Author

@t0yv0 I recreated this because I totally botched trying to rebase from master after the upgrade.

@corymhall corymhall self-assigned this Apr 11, 2024
@corymhall corymhall requested a review from t0yv0 April 11, 2024 18:46
Copy link

Does the PR have any schema changes?

Does the PR have any schema changes?

Looking good! No breaking changes found.
No new resources/functions.

Maintainer note: consult the runbook for dealing with any breaking changes.

Copy link

Is README.md missing any configuration options?

assumeRoleWithWebIdentity not found in Configuration section
customCaBundle not found in Configuration section
defaultTags not found in Configuration section
ec2MetadataServiceEndpoint not found in Configuration section
ec2MetadataServiceEndpointMode not found in Configuration section
httpProxy not found in Configuration section
httpsProxy not found in Configuration section
ignoreTags not found in Configuration section
noProxy not found in Configuration section
retryMode not found in Configuration section
s3UsEast1RegionalEndpoint not found in Configuration section
sharedConfigFiles not found in Configuration section
skipRequestingAccountId not found in Configuration section
stsRegion not found in Configuration section
tokenBucketRateLimiterCapacity not found in Configuration section
useDualstackEndpoint not found in Configuration section

Please add a description for each of these options to README.md. Details about them can be found in either the upstream docs or schema.json.

+ if val, ok := snsGlobalMutex.LoadOrStore(topicArn, localMutex); ok {
+ localMutex = val.(*sync.Mutex)
+ }
+ localMutex.Lock()
Copy link
Member

Choose a reason for hiding this comment

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

This looks right. Thank you! Much appreciated taking some extra care to avoid a global chokepoint.

Copy link
Member

@t0yv0 t0yv0 left a comment

Choose a reason for hiding this comment

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

🚢

@t0yv0
Copy link
Member

t0yv0 commented Apr 12, 2024

When merging please update the merge commit with the original description - we build release notes from the commit messages and it's great to have a good summary there of what the users are getting. Much appreciated.

@corymhall corymhall merged commit a5632df into master Apr 12, 2024
23 checks passed
@corymhall corymhall deleted the sns-topic-creation2 branch April 12, 2024 17:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants