ARN of the SNS topic for lambda event

I need to pass ARN of the SNS topic created on the same stack to lambda event using like below, But I am getting an error. Isn’t that possible to give SNS topic using Ref? I know it can be done with Fn::Join: But Ref would be easier.

SNS Topic.

        ErrorLogNotificationSns:
          Type: AWS::SNS::Topic
          Properties:
            TopicName: ${self:service}-${self:provider.stage}-lambda-errors-log-notification
            DisplayName: Error Notification - Via Slack

Lambda

error-report:
    handler: handlers/errorReporting.notify
    memory: 512
    timeout: 10
    events:
      - http:
          path: error/notify
          method: POST
      - sns:
          arn:
            Ref: ErrorLogNotificationSns
2 Likes