3
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

エラー: The policy failed legacy parsing

Last updated at Posted at 2020-02-06

Serverlessを使っていて以下のエラー。

エラー

  Serverless Error ---------------------------------------
 
  An error occurred: MicroServiceAdminGroupPolicy - The policy failed legacy parsing (Service: AmazonIdentityManagement; Status Code: 400; Error Code: MalformedPolicyDocument; Request ID: xxx-xxx).
 
  Get Support --------------------------------------------
     Docs:          docs.serverless.com
     Bugs:          github.com/serverless/serverless/issues
     Issues:        forum.serverless.com
 
  Your Environment Information ---------------------------
     Operating System:          darwin
     Node Version:              12.4.0
     Framework Version:         1.63.0
     Plugin Version:            3.3.0
     SDK Version:               2.3.0
     Components Core Version:   1.1.2
     Components CLI Version:    1.4.0

テンプレートの内容

  MicroServiceAdminGroupPolicy:
    Type: AWS::IAM::ManagedPolicy
    Properties:
      Description: "foobar"
      Groups:
        - !Ref MicroServiceAdminGroup
      PolicyDocument:
        Version: '2012-10-17'
        Statement:
          # DynamoDB
          - Effect: Allow
            Action:
              - dynamodb:*
            Resource:
              - "arn:aws:dynamodb:#{AWS::Region}:#{AWS::AccountId}:table/${self:service}-*"

原因

↓こいつらが原因。

  • #{AWS::Region}

Serverless Pseudo Parametersの記法だが、プラグインを入れ忘れていた。プラグインを入れることで解決。

npm install serverless-pseudo-parameters --save-dev
serverless.yml
plugins:
  - serverless-pseudo-parameters
3
1
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?