Greetings!,
I have a nonsense CloudFormation behaviour, the problem is in the section where i create an SNS Topic and two SQS Queues in a typical Fan-out pattern:
Resources:
ForwardMessageQueue:
Type: AWS::SQS::Queue
Properties:
QueueName: !Sub 'ForwardMessageQueue${EnvironmentPrm}'
Tags:
- Key: 'Environment'
Value: !Ref EnvironmentPrm
AuditMessageQueue:
Type: AWS::SQS::Queue
Properties:
QueueName: !Sub 'AuditMessageQueue${EnvironmentPrm}'
Tags:
- Key: 'Environment'
Value: !Ref EnvironmentPrm
CallbackNotificationTopic:
Type: AWS::SNS::Topic
Properties:
TopicName: !Sub 'CallbackNotificationTopic${EnvironmentPrm}'
Subscription:
- Endpoint: !GetAtt ForwardMessageQueue.Arn
Protocol: "sqs"
- Endpoint: !GetAtt AuditMessageQueue.Arn
Protocol: "sqs"
Tags:
- Key: 'Environment'
Value: !Ref EnvironmentPrm
The template executes successfully and the solution once deployed, does what it has todo.
The problem is when I checkout the configuration of the Queues through the AWS Web Console, I find seven SNS Subscriptions like:
Subscription ARN | Topic ARN |
---|
arn:aws:sns:us-east-1:012345678901:CallbackNotificationTopicDev:cef23e99-12c6-4120-9219-bb4b7ac05ef4 | arn:aws:sns:us-east-1:012345678901:CallbackNotificationTopicDev |
arn:aws:sns:us-east-1:012345678901:CallbackNotificationTopicDev:afdfc906-5b0d-41f0-9185-572b51fecaf5 | arn:aws:sns:us-east-1:012345678901:CallbackNotificationTopicDev |
arn:aws:sns:us-east-1:012345678901:CallbackNotificationTopicDev:ab1ebde3-91b9-4567-a2b4-9613afefbbd7 | arn:aws:sns:us-east-1:012345678901:CallbackNotificationTopicDev |
arn:aws:sns:us-east-1:012345678901:CallbackNotificationTopicDev:930edf3c-ccb4-4184-b263-32ee64136387 | arn:aws:sns:us-east-1:012345678901:CallbackNotificationTopicDev |
... and other 3 rows more, seven rows in total.
Any idea of the cause of this misbehavior?
Thanks in advanced!.
Today I created a very simple CloudFormation template just for the fan-out pattern (identical to the previous one, I just changed the logical names of the SNS Topic and SQS Queues), the result was as expected: one SNS subscription for every Queue. Exactly the same code in the real solution's template create seven SNS Topic subscriptions per SQS Queue, weird...