threadheap / serverless-ide-vscode

Serverless IDE: Enhanced support for AWS SAM and CloudFormation in VS Code
https://serverless-ide.com/
195 stars 45 forks source link

Inline IAM policy documents for AWS::Serverless::Function show as invalid #128

Closed Sleavely closed 1 year ago

Sleavely commented 3 years ago

Note: what to raise a request for unknown/new or required field or resource, then raise a PR.

68 and #62

are good examples of updating a schema definition. It should not take longer that 15 minutes.

What to prioritizer bugfix or feature? Hit that ❤️support button on the top of the screen.

And don't forget to 🌟star the repo

Bug

For AWS::Serverless::Function resources, Policies is expecting a string or list of strings.

Resources:
  ApiLambda:
    Type: AWS::Serverless::Function
    Properties:
      FunctionName: !Sub ${PROJECT}-api-${ENVIRONMENT}
      CodeUri: dist/src/
      Handler: index.handler
      Policies:
      - Version: 2012-10-17
        Statement:
          - Effect: Allow
            Action:
            - dynamodb:GetItem
            - dynamodb:PutItem
            Resource: !Join [ "", [ !GetAtt PostsTable.Arn, "*" ]]

It should accept inline IAM policy maps as well. From the docs:

Policies accepts a single string or a list of strings, and can be the name of AWS managed policies or AWS SAM policy templates, or inline IAM policy documents formatted in YAML.

https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-resource-function.html#sam-function-policies

It's all squiggly :(

I'm using the "default" validation provider setting.

pavelvlasov commented 1 year ago

This will be resolve in the latest release