JLuu
JLuu

Reputation: 373

Error in CloudFormation Stack: Syntax errors in policy. (Service: AmazonIdentityManagement; Status Code: 400;

This should be fairly straightforward (I hope). I'm working with a CloudFormation Stack through serverless framework and am getting a syntax error. The project is using Lambda to invoke QuickSight API for automated data ingestion.

The error I'm getting is:


  Serverless Error ---------------------------------------

  An error occurred: QuickSightPolicy - Syntax errors in policy. (Service: AmazonIdentityManagement; Status Code: 400; Error Code: MalformedPolicyDocument; Request ID: b2982ca2-7518-4e7d-8258-78240d3a465e; Proxy: null).

And the portion Yaml file with that policy is bellow

    LambdaAssumeRole:
      Type: AWS::IAM::Role
      Properties:
        AssumeRolePolicyDocument:
          Statement:
          - Action: ['sts:AssumeRole']
            Effect: Allow
            Principal:
              Service:
              - lambda.amazonaws.com
    QuickSightPolicy:
      Type: 'AWS::IAM::Policy'
      Properties:
        PolicyDocument:
          Statement:
          - Action: ['quicksight:*']
            Effect: Allow
            Resorce: '*'
        PolicyName: QuickSightPolicy
        Roles: [!Ref 'LambdaAssumeRole']

I omitted the version property, but didn't think that would be an issue for it to run. I'm not exactly sure what else needs to be changed or what is causing the error

Upvotes: 0

Views: 2582

Answers (1)

Pat Myron
Pat Myron

Reputation: 4628

Resorce is a typo of Resource. Recommend trying the CloudFormation Linter in VSCode to see some of these errors inline while authoring templates along with autocompletion and documentation links:

Visual Studio Code extension

[cfn-lint] E2507: IAM Policy statement missing Resource or NotResource
[cfn-lint] E2507: IAM Policy statement key Resorce isn't valid

Upvotes: 3

Related Questions