cdklabs / decdk

Define AWS CDK applications declaratively

Home Page:https://aws.amazon.com/cdk

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot use `aws-cdk-lib.aws_iam.PolicyStatement` directly

mrgrain opened this issue · comments

Trying to do something like this, fails with Property aws-cdk-lib.aws_iam.PolicyStatement is not allowed.yaml-schema: FunctionProps

This should be possible since PolicyStatement can be instantiated. Note that aws-cdk-lib.aws_iam.PolicyStatement.fromJson is accepted.

Resources:
  MyLambda:
    Type: aws-cdk-lib.aws_lambda.Function
    Properties:
      runtime: NODEJS_16_X
      handler: index.handler
      memorySize: 10240
      code:
        aws-cdk-lib.aws_lambda.Code.fromBucket:
          - Ref: 'MyBucket'
          - 'handler.zip'
      initialPolicy:
        - aws-cdk-lib.aws_iam.PolicyStatement:
            actions:
              - s3:GetObject*
              - s3:PutObject*
            resources:
              - '*'