Open drboyer opened 3 years ago
ignoring TopicName or ExistingTopicArn if FifoQueue: true
We'd be trading this off for
ignoring TopicName or ExistingTopicArn if CreateSnsTopic: true
Right? I wonder if what we really need is a breaking change.
A breaking changes might make the interface a bit clearer, yeah. So if you're willing to allow that, we can go that route. In that case, would it make sense to change the behavior to:
❓
If QueueName is provided, create a new queue and subscribe the topic to it (create FIFO topic if a FIFO queue)
Meant TopicName
I think? If so, I think this sounds right.
Found another reason this behavior is somewhat problematic today - the Queue
will automatically create a Queue Policy that grants the SNS topic access to send events to the queue. Unfortunately, there's no way to modify that autogenerated policy, which can cause challenges if you need to, such as if you're trying to subscribe EventBridge events to an SQS queue. Again there's a few different ways we could fix, but just eliminating the SNS-related generated code in some cases would probably be sufficient to solve.
Currently, the Queue shortcut will also create a SNS topic that the created queue is subscribed to, unless one of two conditions are met:
ExistingTopicArn
property is specified, in which case the queue will be subscribed to that topic insteadThere are two things that could be improved about this behavior:
What I'd propose is adding a new property
CreateSnsTopic
with a default value oftrue
(to prevent a breaking change). If it was set tofalse
, we'd skip creation of the SNS topic. Then instead of ignoringTopicName
orExistingTopicArn
ifFifoQueue: true
, we should accept an existing topic ARN (and let CloudFormation validate that it's a FIFO topic), or create a FIFO Topic if it's not andCreateSnsTopic
is notfalse
.Priority
Not super high, as there are workarounds to both of these, and as I said, even if you don't use the Topic that's created, it doesn't really cost you anything.