Can't seem to set SNS trigger when SNS is defined in another stack

I am trying to do something that I initially thought should be quite straight forward, but I am being denied in some really irritating ways and I can’t seem to figure out how to get around these issues. I’m really hoping someone may be able to offer some guidance.

The problem:
I have an SNS topic defined on another cloudformation stack. The ARN and name of this topic are being exported by this other stack. I want to setup a lambda to be triggered by this topic.

I’m able to grab these values using ImportValue without any issues. For example, I subscribed a queue to this topic and then created a lambda that is triggered by this queue. This works fine.

However, like I mentioned, I would really like to create a lambda that is triggered by the topic directly (i.e. cut out the middleman of the queue). I just can’t seem to figure out how to do this.

I’ve tried:

  - sns:
      arn: !ImportValue other-stack-name:exported-arn-value
      topicName: !ImportValue other-stack-name:exported-name-value

However, it seems like the topicName absolutely MUST be a literal string, as in, it doesn’t seem to let me use a function to retrieve this. I can get this working if I hardcode the topicName, however, I can’t hardcode the name here, because this application is going to be deployed in different places and the topicName will vary based on the environment.

I thought that maybe I could settle for setting up the SNS event after my stack was deployed, using a lambda to complete the desired setup. I’ve done some configurations like this for other things that cloudformation doesn’t like, so I thought maybe I would be able to do something like this here as well.

Well, it seems like I can’t setup an SNS event using the AWS SDK… Foiled again…

After trying for a while and coming up against the same basic problems I am about ready to give up and just use a queue as the event source. I thought I would ask here first though.

Any assistance is greatly appreciated.