I’m trying to create a stack where I can upload a file to S3, which publishes to an SNS topic which calls two Lambda functions. I have a simple test:
service:
name: MyTest
# Add the serverless-webpack plugin
plugins:
- serverless-webpack
custom:
stage: $(opt:stage, self:provider.stage)
topicName: SomeTopic
topic: $(self:service)-$(self:custom.topicName)-$(self:custom.stage)
topicArn:
Fn::Sub: arn:aws:sns:$(self:provider.region):${AWS::AccountId}:$(self:custom.topic)
provider:
name: aws
runtime: nodejs8.10
variableSyntax: '\$\(([\s\S]+?)\)'
functions:
first:
handler: first.hello
events:
- sns: $(self:custom.topic)
second:
handler: second.hello
events:
- sns: $(self:custom.topic)
resources:
Resources:
UploadBucket:
Type: AWS::S3::Bucket
DependsOn: SNSTopic$(self:service)$(self:custom.topicName)$(self:custom.stage)
Properties:
BucketName: aa-storage-test-vje8970
NotificationConfiguration:
TopicConfigurations:
- Event: s3:ObjectCreated:Put
Filter:
S3Key:
Rules:
- Name: prefix
Value: staging/
Topic: $(self:custom.topicArn)
Deploying this stack yields this error:
Unable to validate the following destination configurations
It’s referring to the aa-storage-test-vje8970
bucket. How do I build this out in Serverless? This is driving me insane, because I’m specifically having the bucket creation wait till the SNS topic has been created.