aws_sns.topic: grant_publish create invalid access policy for S3 event notifications. #28357
Labels
@aws-cdk/aws-sns
Related to Amazon Simple Notification Service
bug
This issue is a bug.
effort/medium
Medium work item – several days of effort
p2
Describe the bug
When granting publish permission to an external account, the access policy being created is invalid for use with S3 event notification.
When you use the two stacks in the reproduction steps, the stack in account B will produce the following error:
You will get the following error:
The Account B code will deploy properly.
Expected Behavior
This access policy should be created on the SNS topic:
Current Behavior
The following access policy is created:
This policy does not allow the S3 event notification to be created.
Reproduction Steps
Code for AccountA
Code for AccountB
Possible Solution
Based on the code here: https://github.com/aws/aws-cdk/blob/0b4ab1d0ba11b3536a2f7b02b537966de6ac0493/packages/aws-cdk-lib/aws-sns/lib/topic-base.ts#L143C1-L150C4
The policy generation needs to be updated to the working format.
To do this manually, remote the line with
grant_publish
add the following code to the Account A codeAdditional Information/Context
No response
CDK CLI Version
2.114.1
Framework Version
No response
Node.js Version
v21.4.0
OS
MacOS 14.2
Language
Python
Language Version
3.11.5
Other information
No response
The text was updated successfully, but these errors were encountered: