A different team has created several SNS topics to work around the SNS quotas. The ARNs are
arn:aws:sns:us-west-1:xxxx:SomeTopic.fifo
arn:aws:sns:us-west-1:xxxx:SomeTopic1.fifo
arn:aws:sns:us-west-1:xxxx:SomeTopic2.fifo
...
arn:aws:sns:us-west-1:xxxx:SomeTopicN.fifo
I am trying to subscribe an SQS to these topics. My CloudFormation looks like below, with lots of duplication:
{
"AWSTemplateFormatVersion" : "2010-09-09",
"Parameters" : {
"SomeTopicArn" : {
"Type" : "String",
"Default" : "arn:aws:sns:us-west-1:xxxx:SomeTopic.fifo"
},
"SomeTopicArn1" : {
"Type" : "String",
"Default" : "arn:aws:sns:us-west-1:xxxx:SomeTopic1.fifo"
}
},
"Resources" : {
"SomeQueue" : {
"Type" : "AWS::SQS::Queue",
"Properties" : {
"QueueName" : "SomeQueue.fifo",
"FifoQueue" : "true"
}
},
"SubscribeSomeQueueSqsToSomeTopic" : {
"Type" : "AWS::SNS::Subscription",
"Properties" : {
"Protocol" : "sqs",
"Endpoint" : {
"Fn::GetAtt" : [
"SomeQueue",
"Arn"
]
},
"TopicArn" : {
"Ref" : "SomeTopicArn"
}
}
},
"SubscribeSomeQueueSqsToSomeTopic1" : {
"Type" : "AWS::SNS::Subscription",
"Properties" : {
"Protocol" : "sqs",
"Endpoint" : {
"Fn::GetAtt" : [
"SomeQueue",
"Arn"
]
},
"TopicArn" : {
"Ref" : "SomeTopicArn1"
}
}
}
}
}
How can I specify multiple TopicArns in one "AWS::SNS::Subscription" to avoid duplication.
I tried using wild cards in the parameters
"Parameters" : {
"SomeTopicArn" : {
"Type" : "String",
"Default" : "arn:aws:sns:us-west-1:xxxx:SomeTopic*.fifo"
},
but it errors out as invalid ARN.
There is no such way unless you are going to develop your own custom resource or template macro for that.