Question: what's the best way to have optional resources on a Serverless framework based Lambda?
I want to let Serverless cares about resources that the Lambda needs on lower environments (dev, test, staging), and have independent ones for higher environments, like production.
I was thinking about using something like
resources:
Resources: ${file(../${self:provider.stage}-resources.yml)}
my resources yml is like the following:
SQSQueue:
Type: AWS::SQS::Queue
Properties:
QueueName: ${self:service}-${self:provider.stage}-queue
SNSTopic:
Type: AWS::SNS::Topic
Properties:
DisplayName: TEST SNS Topic
TopicName: ${self:service}-${self:provider.stage}-topic
SNSSubscription:
Type: AWS::SNS::Subscription
Properties:
Endpoint: [email protected]
Protocol: email
TopicArn: { "Fn::Join" : ["", ["arn:aws:sns:${self:provider.region}:", { "Ref" : "AWS::AccountId" }, ":${self:resources.Resources.SNSTopic.Properties.TopicName}" ] ] }
But it's not working. Any ideas on what's the best practice to achieve that?
stage-resource.yml? - dege*-resources.ymlfile? - Noel Llevares