Skip to content

Commit 9cb9fb8

Browse files
authored
fix(stepfunctions-tasks): SNS FIFO tasks does not support messageGroupId and messageDeduplicationId (#27369)
`SnsPublish` is failing the execution with FIFO topics due to some missing parameters. This fixes the problem by adding: * [`messageGroupId`](https://docs.aws.amazon.com/sns/latest/api/API_Publish.html#:~:text=Required%3A%20No-,MessageGroupId,-This%20parameter%20applies) - Required for FIFO topics * [`messageDeduplicationId`](https://docs.aws.amazon.com/sns/latest/api/API_Publish.html#:~:text=Required%3A%20No-,MessageDeduplicationId,-This%20parameter%20applies) - Required for FIFO topics with [`contentBasedDeduplication`](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sns-topic.html#cfn-sns-topic-contentbaseddeduplication) disabled Closes #27341. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent b1ce47b commit 9cb9fb8

File tree

11 files changed

+569
-59
lines changed

11 files changed

+569
-59
lines changed

packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sns/integ.publish.js.snapshot/aws-stepfunctions-tasks-sns-publish-integ.assets.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sns/integ.publish.js.snapshot/aws-stepfunctions-tasks-sns-publish-integ.template.json

Lines changed: 99 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -46,19 +46,87 @@
4646
"showmethemessagesawsstepfunctionstaskssnspublishintegcooltopic8388C976F1D63091": {
4747
"Type": "AWS::SNS::Subscription",
4848
"Properties": {
49+
"Endpoint": {
50+
"Fn::GetAtt": [
51+
"showmethemessages8D16BBDB",
52+
"Arn"
53+
]
54+
},
4955
"Protocol": "sqs",
5056
"TopicArn": {
5157
"Ref": "cooltopic4736778A"
58+
}
59+
},
60+
"DependsOn": [
61+
"showmethemessagesPolicyB08B04B0"
62+
]
63+
},
64+
"fifotopicA6114788": {
65+
"Type": "AWS::SNS::Topic",
66+
"Properties": {
67+
"FifoTopic": true,
68+
"TopicName": "awsstepfunctionstaskssnspublishinteg-fifotopic-6FE667F7.fifo"
69+
}
70+
},
71+
"fifoqueue3F2573B3": {
72+
"Type": "AWS::SQS::Queue",
73+
"Properties": {
74+
"FifoQueue": true
75+
},
76+
"UpdateReplacePolicy": "Delete",
77+
"DeletionPolicy": "Delete"
78+
},
79+
"fifoqueuePolicyCA528C39": {
80+
"Type": "AWS::SQS::QueuePolicy",
81+
"Properties": {
82+
"PolicyDocument": {
83+
"Statement": [
84+
{
85+
"Action": "sqs:SendMessage",
86+
"Condition": {
87+
"ArnEquals": {
88+
"aws:SourceArn": {
89+
"Ref": "fifotopicA6114788"
90+
}
91+
}
92+
},
93+
"Effect": "Allow",
94+
"Principal": {
95+
"Service": "sns.amazonaws.com"
96+
},
97+
"Resource": {
98+
"Fn::GetAtt": [
99+
"fifoqueue3F2573B3",
100+
"Arn"
101+
]
102+
}
103+
}
104+
],
105+
"Version": "2012-10-17"
52106
},
107+
"Queues": [
108+
{
109+
"Ref": "fifoqueue3F2573B3"
110+
}
111+
]
112+
}
113+
},
114+
"fifoqueueawsstepfunctionstaskssnspublishintegfifotopic6FE667F78F3219A7": {
115+
"Type": "AWS::SNS::Subscription",
116+
"Properties": {
53117
"Endpoint": {
54118
"Fn::GetAtt": [
55-
"showmethemessages8D16BBDB",
119+
"fifoqueue3F2573B3",
56120
"Arn"
57121
]
122+
},
123+
"Protocol": "sqs",
124+
"TopicArn": {
125+
"Ref": "fifotopicA6114788"
58126
}
59127
},
60128
"DependsOn": [
61-
"showmethemessagesPolicyB08B04B0"
129+
"fifoqueuePolicyCA528C39"
62130
]
63131
},
64132
"StateMachineRoleB840431D": {
@@ -86,9 +154,14 @@
86154
{
87155
"Action": "sns:Publish",
88156
"Effect": "Allow",
89-
"Resource": {
90-
"Ref": "cooltopic4736778A"
91-
}
157+
"Resource": [
158+
{
159+
"Ref": "cooltopic4736778A"
160+
},
161+
{
162+
"Ref": "fifotopicA6114788"
163+
}
164+
]
92165
}
93166
],
94167
"Version": "2012-10-17"
@@ -104,27 +177,35 @@
104177
"StateMachine2E01A3A5": {
105178
"Type": "AWS::StepFunctions::StateMachine",
106179
"Properties": {
107-
"RoleArn": {
108-
"Fn::GetAtt": [
109-
"StateMachineRoleB840431D",
110-
"Arn"
111-
]
112-
},
113180
"DefinitionString": {
114181
"Fn::Join": [
115182
"",
116183
[
117-
"{\"StartAt\":\"publish to SNS\",\"States\":{\"publish to SNS\":{\"Next\":\"Final step\",\"Type\":\"Task\",\"Resource\":\"arn:",
184+
"{\"StartAt\":\"publish to SNS\",\"States\":{\"publish to SNS\":{\"Next\":\"publish to FIFO SNS\",\"Type\":\"Task\",\"Resource\":\"arn:",
118185
{
119186
"Ref": "AWS::Partition"
120187
},
121188
":states:::sns:publish\",\"Parameters\":{\"TopicArn\":\"",
122189
{
123190
"Ref": "cooltopic4736778A"
124191
},
125-
"\",\"Message\":\"sending message over\"}},\"Final step\":{\"Type\":\"Pass\",\"End\":true}},\"TimeoutSeconds\":30}"
192+
"\",\"Message\":\"sending message over\"}},\"publish to FIFO SNS\":{\"Next\":\"Final step\",\"Type\":\"Task\",\"Resource\":\"arn:",
193+
{
194+
"Ref": "AWS::Partition"
195+
},
196+
":states:::sns:publish\",\"Parameters\":{\"TopicArn\":\"",
197+
{
198+
"Ref": "fifotopicA6114788"
199+
},
200+
"\",\"Message\":\"sending message over\",\"MessageDeduplicationId\":\"message-deduplication-id\",\"MessageGroupId\":\"message-group-id\"}},\"Final step\":{\"Type\":\"Pass\",\"End\":true}},\"TimeoutSeconds\":30}"
126201
]
127202
]
203+
},
204+
"RoleArn": {
205+
"Fn::GetAtt": [
206+
"StateMachineRoleB840431D",
207+
"Arn"
208+
]
128209
}
129210
},
130211
"DependsOn": [
@@ -145,6 +226,11 @@
145226
"Value": {
146227
"Ref": "showmethemessages8D16BBDB"
147228
}
229+
},
230+
"fifoQueueUrl": {
231+
"Value": {
232+
"Ref": "fifoqueue3F2573B3"
233+
}
148234
}
149235
},
150236
"Parameters": {

packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sns/integ.publish.js.snapshot/cdk.out

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sns/integ.publish.js.snapshot/integ.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sns/integ.publish.js.snapshot/manifest.json

Lines changed: 33 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)