aws-cdk icon indicating copy to clipboard operation
aws-cdk copied to clipboard

(events-targets): KinesisFirehoseStream should accept a DeliveryStream

Open christophgysin opened this issue 3 years ago • 2 comments

1.116.0 introduces L2 constructs for KinesisFirehose, e.g. DeliveryStream.

events-targets provides a KinesisFirehoseStream target, but expects a CfnDeliveryStream.

Reproduction Steps

import * as cdk from '@aws-cdk/core'
import * as events from '@aws-cdk/aws-events'
import * as targets from '@aws-cdk/aws-events-targets'
import * as firehose from '@aws-cdk/aws-kinesisfirehose'
import * as destinations from '@aws-cdk/aws-kinesisfirehose-destinations'
import * as s3 from '@aws-cdk/aws-s3'

export class CdkEventbridgeStack extends cdk.Stack {
  constructor(scope: cdk.Construct, id: string, props?: cdk.StackProps) {
    super(scope, id, props)

    const eventBus = new events.EventBus(this, 'EventBus')
    const stream = new firehose.DeliveryStream(this, 'Stream', {
      destinations: [
        new destinations.S3Bucket(new s3.Bucket(this, 'StreamBucket')),
      ],
    })
    new events.Rule(this, 'StreamRule', {
      eventBus,
      eventPattern: { account: [cdk.Aws.ACCOUNT_ID] },
       targets: [
         new targets.KinesisFirehoseStream(stream),
       ],
     })
   }
 }

What did you expect to happen?

It compiles.

What actually happened?

Error: Argument of type 'DeliveryStream' is not assignable to parameter of type 'CfnDeliveryStream'.

Environment

  • CDK CLI Version : 1.116.0
  • Framework Version: 1.116.0
  • Node.js Version: 14.17.3
  • OS : linux-5.13.4-arch1-1
  • Language (Version): typescript

Other

I understand this isn't really a bug, but since we now have L2 constructs for DeliveryStream, events-targets should be updated.


This is :bug: Bug Report

christophgysin avatar Jul 29 '21 06:07 christophgysin

The obvious workaround:

const cfnStream = stream.node.defaultChild as firehose.CfnDeliveryStream
new targets.KinesisFirehoseStream(cfnStream)

christophgysin avatar Jul 29 '21 06:07 christophgysin

This issue has not received any attention in 1 year. If you want to keep this issue open, please leave a comment below and auto-close will be canceled.

github-actions[bot] avatar Aug 09 '22 16:08 github-actions[bot]