I am trying to setup a function in one stack that uses an imported SNS topic for an event. Below is the exported SNS topic.
resources:
Resources:
CustomSNSTopic:
Type: "AWS::SNS::Topic"
Properties:
DisplayName: 'CustomSNSTopic'
TopicName: ${self:custom.SNSTopicName}
Outputs:
ExportSNSArn:
Description: The ARN for the exported SNS topic
Value:
"Ref": CustomSNSTopic
Export:
Name: ${opt:stage}-CustomSNSTopic
When I deploy this stack I can see the ARN in the CloudFormation dashboard.
I’m then trying to import this value so I can setup a lambda to have it as an event. When I assign an env variable with {'Fn::ImportValue': ${opt:stage}-CustomSNSTopic}
I can see the arn in the lambda console. But when I try adding that here it fails.
Function:
handler: lambda.handler
events:
- http:
path: somepath
method: post
- sns: {'Fn::ImportValue': {"Fn::Sub" : "${opt:stage}-CustomSNSTopic"}}
I haven’t been able to find any documentation to get this working and would love some help please.