I’m trying to include my lambda roles in a separate file so I can have dev and prod versions.
My iam-roles.dev.yml file looks like this:
MyRole:
Type: AWS::IAM::Role
Properties:
PermissionsBoundary: arn:aws:iam::xxxxx:policy/csr-Developer-Permissions-Boundary
Path: /my/default/path/
RoleName: MyRole-${self:service}
blah...blah...blah
When I include it in my resources->Resources area in my serverless.yml file … I get:
bad indentation of a mapping entry:
22 | Resources:
23 | ${file(../iam-roles.${opt:stage, 'dev'}.yml)}
24 |
25 | ingestGraveyard:
-------------------------^
I have tried every permutation of adding/removing spaces I can think of. When I comment out the file inclusion, I get no errors.
resources:
${file(../iam-roles.${opt:stage, 'dev'}.yml)}
Resources:
ingestGraveyard:
Type: "AWS::SQS::Queue"
Properties:
QueueName: ${file(../evn.${opt:stage, 'dev'}.json):INGEST_GRAVEYARD_NAME}
ingestDLQ:
Type: "AWS::SQS::Queue"
Properties:
QueueName: ${file(../evn.${opt:stage, 'dev'}.json):INGEST_DLQ_NAME}
RedrivePolicy:
deadLetterTargetArn: !GetAtt ingestGraveyard.Arn
maxReceiveCount: 2
If I take the contents of the iam-roles.dev.yml file and simply include them directly in my serverless.yml file… I have no issues at all.