aws-codestarnotifications: missing dependency on target Topic's TopicPolicy #29484
Labels
@aws-cdk/aws-codestarnotifications
bug
This issue is a bug.
effort/medium
Medium work item – several days of effort
p3
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: