Skip to content

Kinesis Enhanced fanout consumer generates broken template #8404

Description

@suparngp

Kinesis Enhanced Fan out consumer setting true introduced in #7320 is broken on serverless version 2.7.0. As compared to v2.4.0, the generated policy document for a consumer: true setting is incorrect.
I am upgrading to the latest since another issue I had reported before #8328 is now resolved.

On 2.4.0, the output is

                {
                  "Effect": "Allow",
                  "Action": [
                    "kinesis:SubscribeToShard"
                  ],
                  "Resource": [
                    {
                      "Ref": "....ArnConsumerStreamConsumer"
                    }
                  ]
                }

where as the same template produces

               {
                  "Effect": "Allow",
                  "Action": [
                    "kinesis:SubscribeToShard"
                  ],
                  "Resource": [
                    "true"
                  ]
                }

The Resource "true" causes deployment to fail.

serverless.yml
plugins:
  - serverless-webpack

custom:
  webpack:
    packager: pnpm
service: myservice
package:
  individually: true
provider:
  name: aws
  stage: api
  stackName: MyServiceStackLambda
  runtime: nodejs12.x
  region: us-east-1
  iamRoleStatements:
    - Effect: Allow
      Action:
        - "kinesis:Get*"
        - "kinesis:DescribeStream"
        - "kinesis:PutRecord"
        - "kinesis:PutRecords"
      Resource:
        - "Fn::ImportValue": MyServiceStack-Kinesis-events-Arn
functions:
  - myfunction:
      handler: src/handlers/index.handler
      events:
        - stream:
            type: kinesis
            arn:
              "Fn::ImportValue": MyServiceStack-Kinesis-events-Arn
            consumer: true
sls deploy output
  An error occurred: IamRoleLambdaExecution - Resource true must be in ARN format or "*". (Service: AmazonIdentityManagement; Status Code: 400; Error Code: MalformedPolicyDocument; Request ID: e8086fcf-abba-4aed-9276-8d28af5edc99; Proxy: null).

Installed version

Framework Core: 2.7.0 (local)
Plugin: 4.1.1
SDK: 2.3.2
Components: 3.2.2

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions