Skip to content

Commit 11384f0

Browse files
authored
fix(scheduler-targets-alpha): kinesis data firehose target uses l1 instead of l2 (#32150)
### Issue # (if applicable) Tracking #31785 ### Reason for this change Since the Kinesis Data Firehose Alpha module is in developer preview and contains the L2 construct for a Firehose Delivery Stream, we should make this upgrade from L1 to L2 now while the module is experimental instead of in the future, where we would need to add a V2 for this target (like for event targets, see #30189) to avoid breaking customers. ### Description of changes Replace CfnDeliveryStream with IDeliveryStream. The L1 uses `S3DestinationConfiguration` property whereas the L2 uses `ExtendedS3DestinationConfiguration` property (includes additional fields on top of S3DestinationConfiguration fields). According to https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-kinesisfirehose-deliverystream.html, "If you change the delivery stream destination from an Amazon S3 destination to an Amazon ES destination, update requires [some interruptions](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-some-interrupt)." ### Description of how you validated changes - Updated unit tests and integration test - Deployed locally using CfnDeliveryStream then IDeliveryStream and verified the objects are written to the S3 bucket. ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license* BREAKING CHANGE: KinesisDataFirehosePutRecord scheduler target now accepts IDeliveryStream instead of CfnDeliveryStream.
1 parent 50d11a3 commit 11384f0

12 files changed

+10934
-15278
lines changed

packages/@aws-cdk/aws-scheduler-targets-alpha/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,8 +257,8 @@ The code snippet below creates an event rule with a delivery stream as a target
257257
called every hour by EventBridge Scheduler with a custom payload.
258258

259259
```ts
260-
import * as firehose from 'aws-cdk-lib/aws-kinesisfirehose';
261-
declare const deliveryStream: firehose.CfnDeliveryStream;
260+
import * as firehose from '@aws-cdk/aws-kinesisfirehose-alpha';
261+
declare const deliveryStream: firehose.IDeliveryStream;
262262

263263
const payload = {
264264
Data: "record",
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
1+
import { IDeliveryStream } from '@aws-cdk/aws-kinesisfirehose-alpha';
12
import { IScheduleTarget } from '@aws-cdk/aws-scheduler-alpha';
23
import { IRole, PolicyStatement } from 'aws-cdk-lib/aws-iam';
3-
import { CfnDeliveryStream } from 'aws-cdk-lib/aws-kinesisfirehose';
44
import { ScheduleTargetBase, ScheduleTargetBaseProps } from './target';
55

66
/**
77
* Use an Amazon Kinesis Data Firehose as a target for AWS EventBridge Scheduler.
88
*/
99
export class KinesisDataFirehosePutRecord extends ScheduleTargetBase implements IScheduleTarget {
1010
constructor(
11-
private readonly deliveryStream: CfnDeliveryStream,
11+
private readonly deliveryStream: IDeliveryStream,
1212
props: ScheduleTargetBaseProps = {},
1313
) {
14-
super(props, deliveryStream.attrArn);
14+
super(props, deliveryStream.deliveryStreamArn);
1515
}
1616

1717
protected addTargetActionToRole(role: IRole): void {
1818

1919
role.addToPrincipalPolicy(new PolicyStatement({
2020
actions: ['firehose:PutRecord'],
21-
resources: [this.deliveryStream.attrArn],
21+
resources: [this.deliveryStream.deliveryStreamArn],
2222
}));
2323
}
2424
}

packages/@aws-cdk/aws-scheduler-targets-alpha/package.json

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,19 +82,23 @@
8282
},
8383
"license": "Apache-2.0",
8484
"devDependencies": {
85+
"@aws-cdk/aws-kinesisfirehose-destinations-alpha": "0.0.0",
86+
"@aws-cdk/aws-kinesisfirehose-alpha": "0.0.0",
87+
"@aws-cdk/aws-scheduler-alpha": "0.0.0",
8588
"@aws-cdk/cdk-build-tools": "0.0.0",
8689
"@aws-cdk/integ-runner": "0.0.0",
90+
"@aws-cdk/integ-tests-alpha": "0.0.0",
8791
"@aws-cdk/pkglint": "0.0.0",
8892
"@types/jest": "^29.5.14",
8993
"aws-cdk-lib": "0.0.0",
90-
"@aws-cdk/aws-scheduler-alpha": "0.0.0",
91-
"constructs": "^10.0.0",
92-
"@aws-cdk/integ-tests-alpha": "0.0.0"
94+
"constructs": "^10.0.0"
9395
},
9496
"dependencies": {},
9597
"peerDependencies": {
96-
"aws-cdk-lib": "^0.0.0",
98+
"@aws-cdk/aws-kinesisfirehose-destinations-alpha": "0.0.0",
99+
"@aws-cdk/aws-kinesisfirehose-alpha": "0.0.0",
97100
"@aws-cdk/aws-scheduler-alpha": "0.0.0",
101+
"aws-cdk-lib": "^0.0.0",
98102
"constructs": "^10.0.0"
99103
},
100104
"engines": {

0 commit comments

Comments
 (0)