So, I just used five hours with my serverless.yml
file over the most ridiculous thing: iamRoleStatements and Resources, which are an arn address to SNS topics, or SQS.
The problem arose as I got a deprecation warning when using serverless-pseudo-parameters, which claims Serverless Framework natively supports pseudo parameters as of version 2.3.0. So I removed it, thinking I can manage.
However, the documentation does not say that pseudo parameters can be used in conjunction with other variables ie. I cannot seem to be able to write something like this:
iamRoleStatements:
- Effect: "Allow"
Action:
- SNS:Publish
Resource:
- 'Fn::Join':
- ''
- - 'arn:aws:logs'
- Ref: 'AWS::Region'
- ':'
- Ref: 'AWS::AccountId'
- ':'
- 'sns-topic-name-'
- ${self:provider.stage}
This will result in an error
An error occurred: IamRoleLambdaExecution - The policy failed legacy parsing (Service: AmazonIdentityManagement; Status Code: 400; Error Code: MalformedPolicyDocument; Request ID: 7d50c7e7-87ad-4f3c-bdc2-e569b916e649; Proxy: null).
So, I went back to using the plugin, which has been archived and deprecated.
I do not know if this will reach the original maintainer, but I urge him to restore this plugin. It may be that Serverless Framework now supports these pseudo parameters, but weâre talking about ease of use here.
Iâd rather write:
Resource: "arn:aws:sns:${self:provider.region}:#{AWS::AccountId}:sns-topic-name-${self:provider.stage}"
Than that horrible multiline monster using Fn::Join
.
So, is there some hidden documentation page covering this issue, or are we stuck with a deprecated plugin to make this work?