2
votes

I have an AWS Cloudformation template for creating N number of SQS Queues. The template doesn't contain any other type of resource.

Each SQS queue format looks like:

"logical-name-of-queue": {
  "Type": "AWS::SQS::Queue",
  "Properties": {
    "QueueName": "queue-name",
    "DelaySeconds": "0",
    "MaximumMessageSize": "262144",
    "MessageRetentionPeriod": "345600",
    "ReceiveMessageWaitTimeSeconds": "20",
    "VisibilityTimeout": "300"
  }
}

The template should output the "QueueName" of all the Queues. I can include each queue's name in the output like:

"Outputs" : {
    "name-of-queue-" : {
      "Value" : { "Fn::GetAtt" : [ "logical-name-of-queue", "QueueName" ]}
    }
}

But, as N can be large, is there any way to specify the output block is such a way that there is no need to write such output block for each queue?

1

1 Answers

1
votes

No. As of today cloudformation doesn't support any kind of for loops

What you can do is to create a JSON some place else (python, ruby, java...). And then load result to CloudFormation API.

Here is a very handy library written in python: troposphere