I have a role definition in my serverless.yml
which provides Lamdba functions the right to execute:
lambdaInvocation:
Type: AWS::IAM::Policy
Properties:
PolicyName: truecash-invocation
PolicyDocument:
Version: '2012-10-17'
Statement:
- Effect: Allow
Action:
- lambda:InvokeFunction
- lambda:ListFunctions
Resource:
- "arn:aws:lambda:${self:custom.region}:*:function:truecash-services-${self:custom.stage}-*"
Roles:
- truecash-services-${self:custom.stage}-accounting
- truecash-services-${self:custom.stage}-${self:provider.region}-lambdaRole
In my Dev environment this works just fine but now that I want to deploy to Prod I have a problem. It seems that when you deploy to a new stage it doesn’t setup the roles first and therefore my deployment fails because the functions depend on the role but the role hasn’t been created yet.
How can I get around this? Can I deploy only the resources?