L2 SNS Topic: Setting enforceSSL prop to true does not create AWS::SNS::TopicPolicy #31558
Closed
1 task
Labels
@aws-cdk/aws-sns
Related to Amazon Simple Notification Service
bug
This issue is a bug.
effort/small
Small work item – less than a day of effort
p2
Describe the bug
CDK Version used:
2.147.2
Steps to Reproduce:
enforceSSL
prop set to true.AWS::SNS::TopicPolicy
with a statement that denies any sns::Publish if aws:SecureTransport is false, as follows:AWS::SNS::TopicPolicy
. However, if you haven a policy statement being added as follows to the Topic via.addToResourcePolicy(..)
:then CDK correctly creates an
AWS::SNS::TopicPolicy
and appends the above statement to it:Regression Issue
Last Known Working CDK Version
No response
Expected Behavior
When a user synthesizes a CDK stack containing L2 SNS Topic with
enforceSSL
set to true, then CDK should output a CloudFormation stack that contains anAWS::SNS::TopicPolicy
with a statement that "Adds a statement to enforce encryption of data in transit when publishing to the topic" as defined in the CDK documentation.Current Behavior
When a user synthesizes a CDK stack containing L2 SNS Topic with
enforceSSL
set to true, CDK does not output a CloudFormation stack that contains anAWS::SNS::TopicPolicy
with a statement that "Adds a statement to enforce encryption of data in transit when publishing to the topic" as defined in the CDK documentation.CDK however handles this correctly when there is a policy being added to the Topic via
.addToResourcePolicy()
. In this case, aAWS::SNS::TopicPolicy
is included in the synthesized CloudFormation template where the statement that blocks sns::Publish from sources that do not use SSL.Reproduction Steps
aws-cdk-lib Version used:
2.147.2
Steps to Reproduce:
enforceSSL
prop set to true.AWS::SNS::TopicPolicy
with a statement that denies any sns::Publish if aws:SecureTransport is false, as follows:AWS::SNS::TopicPolicy
. However, if you haven a policy statement being added as follows to the Topic via.addToResourcePolicy(..)
:then CDK correctly creates an
AWS::SNS::TopicPolicy
and appends the above statement to it:Possible Solution
No response
Additional Information/Context
No response
CDK CLI Version
2.156.0
Framework Version
No response
Node.js Version
18.20.2
OS
MacOS Sonoma 14.6.1
Language
TypeScript
Language Version
No response
Other information
No response
The text was updated successfully, but these errors were encountered: