serverless-iam-roles-per-function icon indicating copy to clipboard operation
serverless-iam-roles-per-function copied to clipboard

Global Role Name is not in expected format

Open ghost opened this issue 3 years ago • 1 comments

I have the following serverless.yml (snippet)

  iam:
    role:
      name: ${self:provider.stage}-${self:service.name}-default-role
      statements:
        - Effect: Allow
          Action:
            - ssm:GetParameter
            - ssm:GetParameters
          Resource:
            - !Sub "arn:aws:ssm:${self:provider.region}:${AWS::AccountId}:parameter/${self:provider.stage}/*"

And when trying to deploy I get:

ERROR: Global Role Name is not in expected format. Got name: "test-rest-ra-gui-apis-default-role"

This used to work up until some time ago (maybe I updated serverless or the plugin inadvertently)

Looking at the source code it's doing:

    const roleName = this.serverless.providers.aws.naming.getRoleName();
    const fnJoin = roleName['Fn::Join'];

And checking some things on fnJoin, which puzzles me because I didn't find in the documentation any reference to it

Any clues?

Thanks

ghost avatar Jan 26 '22 17:01 ghost