Skip to content

Commit b8033aa

Browse files
authored
Merge branch 'main' into allen/aws-lambda-secrets-manager
2 parents 546f6d0 + c36b752 commit b8033aa

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+387
-37
lines changed

Diff for: .github/mergify.yml

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# See https://doc.mergify.io
2+
3+
pull_request_rules:
4+
- name: label core
5+
actions:
6+
label:
7+
add: [ contribution/core ]
8+
conditions:
9+
- author~=^(hnishar|biffgaut)$
10+
- -label~="contribution/core"
11+
- name: automatic merge
12+
actions:
13+
comment:
14+
message: Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to [allow changes to be pushed to your fork](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/allowing-changes-to-a-pull-request-branch-created-from-a-fork)).
15+
merge:
16+
strict: smart
17+
method: squash
18+
strict_method: merge
19+
commit_message: title+body
20+
conditions:
21+
- base!=release
22+
- -title~=(WIP|wip)
23+
- -label~=(blocked|do-not-merge|no-squash|two-approvers)
24+
- -merged
25+
- -closed
26+
- author!=dependabot[bot]
27+
- author!=dependabot-preview[bot]
28+
- "#approved-reviews-by>=1"
29+
- -approved-reviews-by~=author
30+
- "#changes-requested-reviews-by=0"
31+
- status-success~=AWS CodeBuild us-east-1
32+
- name: automatic merge (no-squash)
33+
actions:
34+
comment:
35+
message: Thank you for contributing! Your pull request will be automatically updated and merged without squashing (do not update manually, and be sure to [allow changes to be pushed to your fork](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/allowing-changes-to-a-pull-request-branch-created-from-a-fork)).
36+
merge:
37+
strict: smart
38+
# Merge instead of squash
39+
method: merge
40+
strict_method: merge
41+
commit_message: title+body
42+
conditions:
43+
- -title~=(WIP|wip)
44+
- -label~=(blocked|do-not-merge)
45+
# Only if no-squash is set
46+
- label~=no-squash
47+
- -merged
48+
- -closed
49+
- author!=dependabot[bot]
50+
- author!=dependabot-preview[bot]
51+
- "#approved-reviews-by>=1"
52+
- -approved-reviews-by~=author
53+
- "#changes-requested-reviews-by=0"
54+
- status-success~=AWS CodeBuild us-east-1

Diff for: .github/workflows/auto-approve.yml

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Approve PRs with "pr/auto-approve". mergify takes care of the actual merge.
2+
3+
name: auto-approve
4+
on:
5+
pull_request:
6+
types: [ labeled, unlabeled, opened, synchronize, reopened, ready_for_review, review_requested ]
7+
8+
jobs:
9+
auto-approve:
10+
if: >
11+
contains(github.event.pull_request.labels.*.name, 'pr/auto-approve') &&
12+
(github.event.pull_request.user.login == 'aws-solutions-constructs-team'
13+
|| github.event.pull_request.user.login == 'dependabot[bot]'
14+
|| github.event.pull_request.user.login == 'dependabot-preview[bot]')
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: hmarr/[email protected]
18+
with:
19+
github-token: "${{ secrets.GITHUB_TOKEN }}"

Diff for: .viperlightignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ source/patterns/@aws-solutions-constructs/aws-apigateway-iot/test/integ.defaultP
3131
source/patterns/@aws-solutions-constructs/aws-apigateway-iot/test/integ.overrideParams.expected.json:269
3232
source/patterns/@aws-solutions-constructs/aws-apigateway-iot/test/test.apigateway-iot.test.ts:29
3333
source/patterns/@aws-solutions-constructs/aws-apigateway-iot/test/integ.override_auth_api_keys.expected.json:267
34-
source/patterns/@aws-solutions-constructs/aws-cloudfront-s3/test/test.cloudfront-s3.test.ts:110
34+
source/patterns/@aws-solutions-constructs/aws-cloudfront-s3/test/test.cloudfront-s3.test.ts:111
3535
source/patterns/@aws-solutions-constructs/core/test/cloudfront-distribution-s3-helper.test.ts:164
3636
source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/test.s3-sqs.test.ts:251
3737
source/use_cases/aws-custom-glue-etl/stream-producer/generate_data.py:86

Diff for: CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
44

5+
## [1.100.0](https://github.com/awslabs/aws-solutions-constructs/compare/v1.99.0...v1.100.0) (2021-04-28)
6+
7+
### Changed
8+
- Upgraded all patterns to CDK v1.100.0
9+
- BREAKING CHANGE: Fixed issue with refreshing Integration Tests leaving Resources Behind in Account ([#164](https://github.com/awslabs/aws-solutions-constructs/pull/164))
10+
511
## [1.99.0](https://github.com/awslabs/aws-solutions-constructs/compare/v1.98.0...v1.99.0) (2021-04-22)
612

713
### Changed

Diff for: source/lerna.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@
66
"./patterns/@aws-solutions-constructs/*"
77
],
88
"rejectCycles": "true",
9-
"version": "1.99.0"
9+
"version": "1.100.0"
1010
}

Diff for: source/patterns/@aws-solutions-constructs/aws-cloudfront-s3/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ _Parameters_
4949

5050
| **Name** | **Type** | **Description** |
5151
|:-------------|:----------------|-----------------|
52-
|existingBucketObj?|[`s3.Bucket`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-s3.Bucket.html)|Existing instance of S3 Bucket object, if this is set then the bucketProps is ignored.|
52+
|existingBucketObj?|[`s3.Bucket`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-s3.Bucket.html)|Existing instance of S3 Bucket object. If this is provided, then also providing bucketProps is an error. |
5353
|bucketProps?|[`s3.BucketProps`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-s3.BucketProps.html)|User provided props to override the default props for the S3 Bucket.|
5454
|cloudFrontDistributionProps?|[`cloudfront.DistributionProps`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-cloudfront.DistributionProps.html)|Optional user provided props to override the default props for CloudFront Distribution|
5555
|insertHttpSecurityHeaders?|`boolean`|Optional user provided props to turn on/off the automatic injection of best practice HTTP security headers in all responses from CloudFront|

Diff for: source/patterns/@aws-solutions-constructs/aws-cloudfront-s3/lib/index.ts

+4
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ export class CloudFrontToS3 extends Construct {
6767
super(scope, id);
6868
let bucket: s3.Bucket;
6969

70+
if (props.existingBucketObj && props.bucketProps) {
71+
throw new Error('Cannot specify both bucket properties and an existing bucket');
72+
}
73+
7074
if (!props.existingBucketObj) {
7175
[this.s3Bucket, this.s3LoggingBucket] = defaults.buildS3Bucket(this, {
7276
bucketProps: props.bucketProps

Diff for: source/patterns/@aws-solutions-constructs/aws-cloudfront-s3/test/integ.existing-bucket.ts

+1-4
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,10 @@ const app = new App();
2525
const stack = new Stack(app, 'test-cloudfront-s3-existing-bucket-stack');
2626

2727
let mybucket: s3.Bucket;
28-
mybucket = defaults.CreateScrapBucket(stack, {});
28+
mybucket = defaults.CreateScrapBucket(stack, { removalPolicy: RemovalPolicy.DESTROY });
2929

3030
const _construct = new CloudFrontToS3(stack, 'test-cloudfront-s3', {
3131
existingBucketObj: mybucket,
32-
bucketProps: {
33-
removalPolicy: RemovalPolicy.DESTROY,
34-
}
3532
});
3633

3734
// Add Cache Policy

Diff for: source/patterns/@aws-solutions-constructs/aws-cloudfront-s3/test/test.cloudfront-s3.test.ts

+23
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import * as cdk from "@aws-cdk/core";
1717
import * as s3 from '@aws-cdk/aws-s3';
1818
import '@aws-cdk/assert/jest';
1919
import * as acm from '@aws-cdk/aws-certificatemanager';
20+
import { RemovalPolicy } from '@aws-cdk/core';
2021

2122
function deploy(stack: cdk.Stack) {
2223
return new CloudFrontToS3(stack, 'test-cloudfront-s3', {
@@ -200,3 +201,25 @@ test('check properties', () => {
200201
expect(construct.cloudFrontWebDistribution !== null);
201202
expect(construct.s3Bucket !== null);
202203
});
204+
205+
// --------------------------------------------------------------
206+
// Test bad call with existingBucket and bucketProps
207+
// --------------------------------------------------------------
208+
test("Test bad call with existingBucket and bucketProps", () => {
209+
// Stack
210+
const stack = new cdk.Stack();
211+
212+
const testBucket = new s3.Bucket(stack, 'test-bucket', {});
213+
214+
const app = () => {
215+
// Helper declaration
216+
new CloudFrontToS3(stack, "bad-s3-args", {
217+
existingBucketObj: testBucket,
218+
bucketProps: {
219+
removalPolicy: RemovalPolicy.DESTROY
220+
},
221+
});
222+
};
223+
// Assertion
224+
expect(app).toThrowError();
225+
});

Diff for: source/patterns/@aws-solutions-constructs/aws-events-rule-kinesisfirehose-s3/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ _Parameters_
5858
|:-------------|:----------------|-----------------|
5959
|eventRuleProps|[`events.RuleProps`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-events.RuleProps.html)|User provided eventRuleProps to override the defaults.|
6060
|kinesisFirehoseProps?|[`kinesisfirehose.CfnDeliveryStreamProps`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-kinesisfirehose.CfnDeliveryStreamProps.html)|Optional user provided props to override the default props for Kinesis Firehose Delivery Stream|
61-
|existingBucketObj?|[`s3.IBucket`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-s3.IBucket.html)|Existing instance of S3 Bucket object, if this is set then the bucketProps is ignored.|
61+
|existingBucketObj?|[`s3.IBucket`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-s3.IBucket.html)|Existing instance of S3 Bucket object. If this is provided, then also providing bucketProps is an error. |
6262
|bucketProps?|[`s3.BucketProps`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-s3.BucketProps.html)|User provided props to override the default props for the S3 Bucket.|
6363
|logGroupProps?|[`logs.LogGroupProps`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-logs.LogGroupProps.html)|User provided props to override the default props for for the CloudWatchLogs LogGroup.|
6464

Diff for: source/patterns/@aws-solutions-constructs/aws-events-rule-kinesisfirehose-s3/lib/index.ts

+4
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,10 @@ export class EventsRuleToKinesisFirehoseToS3 extends Construct {
7777
constructor(scope: Construct, id: string, props: EventsRuleToKinesisFirehoseToS3Props) {
7878
super(scope, id);
7979

80+
if (props.existingBucketObj && props.bucketProps) {
81+
throw new Error('Cannot specify both bucket properties and an existing bucket');
82+
}
83+
8084
// Set up the Kinesis Firehose using KinesisFirehoseToS3 construct
8185
const firehoseToS3 = new KinesisFirehoseToS3(this, 'KinesisFirehoseToS3', {
8286
kinesisFirehoseProps: props.kinesisFirehoseProps,

Diff for: source/patterns/@aws-solutions-constructs/aws-events-rule-kinesisfirehose-s3/test/events-rule-kinesisfirehose-s3.test.ts

+27
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
import { SynthUtils } from '@aws-cdk/assert';
1515
import * as cdk from "@aws-cdk/core";
16+
import * as s3 from "@aws-cdk/aws-s3";
1617
import * as events from "@aws-cdk/aws-events";
1718
import '@aws-cdk/assert/jest';
1819
import {EventsRuleToKinesisFirehoseToS3, EventsRuleToKinesisFirehoseToS3Props} from '../lib';
@@ -123,4 +124,30 @@ test('Test property override', () => {
123124
SizeInMBs: 55
124125
}
125126
}});
127+
});
128+
129+
// --------------------------------------------------------------
130+
// Test bad call with existingBucket and bucketProps
131+
// --------------------------------------------------------------
132+
test("Test bad call with existingBucket and bucketProps", () => {
133+
// Stack
134+
const stack = new cdk.Stack();
135+
136+
const testBucket = new s3.Bucket(stack, 'test-bucket', {});
137+
138+
const app = () => {
139+
// Helper declaration
140+
new EventsRuleToKinesisFirehoseToS3(stack, "bad-s3-args", {
141+
eventRuleProps: {
142+
description: 'event rule props',
143+
schedule: events.Schedule.rate(cdk.Duration.minutes(5))
144+
},
145+
existingBucketObj: testBucket,
146+
bucketProps: {
147+
removalPolicy: cdk.RemovalPolicy.DESTROY
148+
},
149+
});
150+
};
151+
// Assertion
152+
expect(app).toThrowError();
126153
});

Diff for: source/patterns/@aws-solutions-constructs/aws-iot-kinesisfirehose-s3/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ _Parameters_
6363
|iotTopicRuleProps|[`iot.CfnTopicRuleProps`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-iot.CfnTopicRuleProps.html)|User provided CfnTopicRuleProps to override the defaults|
6464
|kinesisFirehoseProps?|[`kinesisfirehose.CfnDeliveryStreamProps`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-kinesisfirehose.CfnDeliveryStreamProps.html)|Optional user provided props to override the default props for Kinesis Firehose Delivery Stream|
6565
|existingBucketObj?|[`s3.IBucket`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-s3.IBucket.html)|Existing instance of S3 Bucket object, if this is set then the bucketProps is ignored.|
66-
|bucketProps?|[`s3.BucketProps`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-s3.BucketProps.html)|User provided props to override the default props for the S3 Bucket.|
66+
|bucketProps?|[`s3.BucketProps`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-s3.BucketProps.html)|User provided props to override the default props for the S3 Bucket. If this is provided, then also providing bucketProps is an error. |
6767
|logGroupProps?|[`logs.LogGroupProps`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-logs.LogGroupProps.html)|User provided props to override the default props for for the CloudWatchLogs LogGroup.|
6868

6969
## Pattern Properties

Diff for: source/patterns/@aws-solutions-constructs/aws-iot-kinesisfirehose-s3/lib/index.ts

+4
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,10 @@ export class IotToKinesisFirehoseToS3 extends Construct {
7777
constructor(scope: Construct, id: string, props: IotToKinesisFirehoseToS3Props) {
7878
super(scope, id);
7979

80+
if (props.existingBucketObj && props.bucketProps) {
81+
throw new Error('Cannot specify both bucket properties and an existing bucket');
82+
}
83+
8084
const firehoseToS3 = new KinesisFirehoseToS3(this, 'KinesisFirehoseToS3', {
8185
kinesisFirehoseProps: props.kinesisFirehoseProps,
8286
existingBucketObj: props.existingBucketObj,

Diff for: source/patterns/@aws-solutions-constructs/aws-iot-kinesisfirehose-s3/test/test.iot-kinesisfirehose-s3.test.ts

+31
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import { SynthUtils } from '@aws-cdk/assert';
1515
import { IotToKinesisFirehoseToS3, IotToKinesisFirehoseToS3Props } from "../lib";
1616
import * as cdk from "@aws-cdk/core";
17+
import * as s3 from "@aws-cdk/aws-s3";
1718
import '@aws-cdk/assert/jest';
1819

1920
function deploy(stack: cdk.Stack) {
@@ -130,3 +131,33 @@ test('check properties', () => {
130131
expect(construct.kinesisFirehoseLogGroup !== null);
131132
expect(construct.s3LoggingBucket !== null);
132133
});
134+
135+
// --------------------------------------------------------------
136+
// Test bad call with existingBucket and bucketProps
137+
// --------------------------------------------------------------
138+
test("Test bad call with existingBucket and bucketProps", () => {
139+
// Stack
140+
const stack = new cdk.Stack();
141+
142+
const testBucket = new s3.Bucket(stack, 'test-bucket', {});
143+
144+
const app = () => {
145+
// Helper declaration
146+
new IotToKinesisFirehoseToS3(stack, "bad-s3-args", {
147+
iotTopicRuleProps: {
148+
topicRulePayload: {
149+
ruleDisabled: false,
150+
description: "Persistent storage of connected vehicle telematics data",
151+
sql: "SELECT * FROM 'connectedcar/telemetry/#'",
152+
actions: []
153+
}
154+
},
155+
existingBucketObj: testBucket,
156+
bucketProps: {
157+
removalPolicy: cdk.RemovalPolicy.DESTROY
158+
},
159+
});
160+
};
161+
// Assertion
162+
expect(app).toThrowError();
163+
});

Diff for: source/patterns/@aws-solutions-constructs/aws-kinesisfirehose-s3-and-kinesisanalytics/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ _Parameters_
8080
|:-------------|:----------------|-----------------|
8181
|kinesisFirehoseProps?|[`kinesisFirehose.CfnDeliveryStreamProps`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-kinesisfirehose.CfnDeliveryStreamProps.html)|Optional user-provided props to override the default props for the Kinesis Firehose delivery stream.|
8282
|kinesisAnalyticsProps?|[`kinesisAnalytics.CfnApplicationProps`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-kinesisanalytics.CfnApplicationProps.html)|Optional user-provided props to override the default props for the Kinesis Analytics application.|
83-
|existingBucketObj?|[`s3.IBucket`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-s3.IBucket.html)|Existing instance of S3 Bucket object, if this is set then the bucketProps is ignored.|
83+
|existingBucketObj?|[`s3.IBucket`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-s3.IBucket.html)|Existing instance of S3 Bucket object. If this is provided, then also providing bucketProps is an error. |
8484
|bucketProps?|[`s3.BucketProps`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-s3.BucketProps.html)|User provided props to override the default props for the S3 Bucket.|
8585
|logGroupProps?|[`logs.LogGroupProps`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-logs.LogGroupProps.html)|User provided props to override the default props for for the CloudWatchLogs LogGroup.|
8686

Diff for: source/patterns/@aws-solutions-constructs/aws-kinesisfirehose-s3-and-kinesisanalytics/lib/index.ts

+4
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,10 @@ export class KinesisFirehoseToAnalyticsAndS3 extends Construct {
7979
constructor(scope: Construct, id: string, props: KinesisFirehoseToAnalyticsAndS3Props) {
8080
super(scope, id);
8181

82+
if (props.existingBucketObj && props.bucketProps) {
83+
throw new Error('Cannot specify both bucket properties and an existing bucket');
84+
}
85+
8286
// Setup the kinesisfirehose-s3 pattern
8387
const kinesisFirehoseToS3Props: KinesisFirehoseToS3Props = {
8488
kinesisFirehoseProps: props.kinesisFirehoseProps,

Diff for: source/patterns/@aws-solutions-constructs/aws-kinesisfirehose-s3-and-kinesisanalytics/test/test.kinesisfirehose-analytics-s3.test.ts

+23
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
// Imports
1515
import { SynthUtils } from '@aws-cdk/assert';
1616
import { Stack, RemovalPolicy } from '@aws-cdk/core';
17+
import * as s3 from '@aws-cdk/aws-s3';
1718
import { KinesisFirehoseToAnalyticsAndS3, KinesisFirehoseToAnalyticsAndS3Props } from '../lib';
1819
import '@aws-cdk/assert/jest';
1920

@@ -143,4 +144,26 @@ test('test kinesisFirehose override ', () => {
143144
SizeInMBs: 55
144145
}
145146
}});
147+
});
148+
149+
// --------------------------------------------------------------
150+
// Test bad call with existingBucket and bucketProps
151+
// --------------------------------------------------------------
152+
test("Test bad call with existingBucket and bucketProps", () => {
153+
// Stack
154+
const stack = new Stack();
155+
156+
const testBucket = new s3.Bucket(stack, 'test-bucket', {});
157+
158+
const app = () => {
159+
// Helper declaration
160+
new KinesisFirehoseToAnalyticsAndS3(stack, "bad-s3-args", {
161+
existingBucketObj: testBucket,
162+
bucketProps: {
163+
removalPolicy: RemovalPolicy.DESTROY
164+
},
165+
});
166+
};
167+
// Assertion
168+
expect(app).toThrowError();
146169
});

Diff for: source/patterns/@aws-solutions-constructs/aws-kinesisfirehose-s3/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ _Parameters_
5050
| **Name** | **Type** | **Description** |
5151
|:-------------|:----------------|-----------------|
5252
|bucketProps?|[`s3.BucketProps`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-s3.BucketProps.html)|Optional user provided props to override the default props for the S3 Bucket.|
53-
|existingBucketObj?|[`s3.IBucket`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-s3.IBucket.html)|Optional existing instance of S3 Bucket, if this is set then bucketProps and existingLoggingBucketObj are ignored.|
53+
|existingBucketObj?|[`s3.IBucket`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-s3.IBucket.html)|Optional existing instance of S3 Bucket. If this is provided, then also providing bucketProps is an error. |
5454
|existingLoggingBucketObj?|[`s3.IBucket`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-s3.IBucket.html)|Optional existing instance of logging S3 Bucket for the S3 Bucket created by the pattern.|
5555
|kinesisFirehoseProps?|[`kinesisfirehose.CfnDeliveryStreamProps`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-kinesisfirehose.CfnDeliveryStreamProps.html)\|`any`|Optional user provided props to override the default props for Kinesis Firehose Delivery Stream.|
5656
|logGroupProps?|[`logs.LogGroupProps`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-logs.LogGroupProps.html)|Optional user provided props to override the default props for for the CloudWatchLogs LogGroup.|

Diff for: source/patterns/@aws-solutions-constructs/aws-kinesisfirehose-s3/lib/index.ts

+4
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,10 @@ export class KinesisFirehoseToS3 extends Construct {
7878

7979
let bucket: s3.IBucket;
8080

81+
if (props.existingBucketObj && props.bucketProps) {
82+
throw new Error('Cannot specify both bucket properties and an existing bucket');
83+
}
84+
8185
// Setup S3 Bucket
8286
if (!props.existingBucketObj) {
8387
let { bucketProps } = props;

Diff for: source/patterns/@aws-solutions-constructs/aws-kinesisfirehose-s3/test/test.kinesisfirehose-s3.test.ts

+22
Original file line numberDiff line numberDiff line change
@@ -192,3 +192,25 @@ test('check for no SSE encryption for KinesisFirehoseToS3', () => {
192192
},
193193
});
194194
});
195+
196+
// --------------------------------------------------------------
197+
// Test bad call with existingBucket and bucketProps
198+
// --------------------------------------------------------------
199+
test("Test bad call with existingBucket and bucketProps", () => {
200+
// Stack
201+
const stack = new cdk.Stack();
202+
203+
const testBucket = new s3.Bucket(stack, 'test-bucket', {});
204+
205+
const app = () => {
206+
// Helper declaration
207+
new KinesisFirehoseToS3(stack, "bad-s3-args", {
208+
existingBucketObj: testBucket,
209+
bucketProps: {
210+
removalPolicy: cdk.RemovalPolicy.DESTROY
211+
},
212+
});
213+
};
214+
// Assertion
215+
expect(app).toThrowError();
216+
});

0 commit comments

Comments
 (0)