I am trying to deploy a service to AWS using serverless framework and keep getting the following error: Error: The CloudFormation template is invalid: Template error: instance of Fn::GetAtt references undefined resource dev-example
Here are the relevant parts of my serverless.yml file:
service: example
provider:
name: aws
runtime: python3.7
memorySize: 128
logRetentionInDays: 1
timeout: 300
role: ${opt:stage}-${self:service}
resources:
Resources:
dev-example:
Type: AWS::IAM::Role
Properties:
RoleName: ${opt:stage}-${self:service}-role
AssumeRolePolicyDocument:
Version: '2020-05-13'
Statement:
- Effect: Allow
Principal:
Service:
- lambda.amazonaws.com
Action: 'sts:AssumeRole'
ManagedPolicyArns:
- arn:aws:iam::aws:policy/service-role/AWSLambdaVPCAccessExecutionRole
- arn:aws:iam::aws:policy/AmazonRDSDataFullAccess
- arn:aws:iam::aws:policy/AmazonS3ReadOnlyAccess
- arn:aws:iam::aws:policy/service-role/AWSLambdaRole
Policies:
- PolicyName: ${opt:stage}-${self:service}-policies
PolicyDocument:
Version: '2020-05-13'
Statement:
- Effect: Allow
Action:
- logs:CreateLogGroups
- logs:CreateLogStream
- logs:PutLogEvents
Resource:
- 'Fn::Join':
- ':'
-
- 'arn:aws:logs'
- Ref: 'AWS::Region'
- Ref: 'AWS::AccountId'
- 'log-group:/aws/lambda/*:*:*'
Any insights as to what is causing this error would be great!
The resources format for the custom IAM Role was created using the template here: https://www.serverless.com/framework/docs/providers/aws/guide/iam/