-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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-codestarnotifications: missing dependency on target Topic's TopicPolicy #29484
Comments
Yes the notification rule would implicitly depend on the topic but not the topic policy. Under the hood the topic and topic policy would be provisioned in parallel and there would be a chance topic policy is not provisioned yet. Yep, the workaround is the best solution. We could note this in the doc to help the community. Are you interested to submit a PR for that? |
This issue has not received a response in a while. If you want to keep this issue open, please leave a comment below and auto-close will be canceled. |
The given workaround might be the best solution for a workaround, but surely an actual solution would be to have CDK generate the dependency automatically? I don't have the capacity to create a PR for this, sorry. |
No worries. We welcome any PR to improve this. |
Describe the bug
When deploying a stack with an SNS
Topic
andNotificationRule
for a CodePipeline, it appears theNotificationRule
will verify that it is able to send messages to theTopic
and could fail if theTopicPolicy
has not been deployed yet.My
TopicPolicy
andNotifactionRule
were being deployed simultaneously by CloudFormation and theNotificationRule
deployment failed with errorThis seems to be caused by
addTarget
in https://github.com/aws/aws-cdk/blob/main/packages/aws-cdk-lib/aws-codestarnotifications/lib/notification-rule.ts not adding a dependency to the Topic's policy.Expected Behavior
NotificationRule
is deployed successfully.Current Behavior
A race condition caused the NotificationRule deployment to fail if the TopicPolicy happens to not have been deployed yet.
Reproduction Steps
Cannot be consistently reproduced.
Possible Solution
In
addTarget
, for eachNotificationRule
target that is aTopic
that is created in the same stack, add a dependency on the topic's policy.Workaround, explicitly add the dependency:
Additional Information/Context
No response
CDK CLI Version
2.132.1 (build 9df7dd3)
Framework Version
No response
Node.js Version
v20.10.0
OS
Windows 10 Version 22H2
Language
TypeScript
Language Version
No response
Other information
No response
The text was updated successfully, but these errors were encountered: