Skip to content

Commit

Permalink
Merge branch 'main' into allen/aws-lambda-secrets-manager
Browse files Browse the repository at this point in the history
  • Loading branch information
hnishar authored May 5, 2021
2 parents 546f6d0 + c36b752 commit b8033aa
Show file tree
Hide file tree
Showing 41 changed files with 387 additions and 37 deletions.
54 changes: 54 additions & 0 deletions .github/mergify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# See https://doc.mergify.io

pull_request_rules:
- name: label core
actions:
label:
add: [ contribution/core ]
conditions:
- author~=^(hnishar|biffgaut)$
- -label~="contribution/core"
- name: automatic merge
actions:
comment:
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)).
merge:
strict: smart
method: squash
strict_method: merge
commit_message: title+body
conditions:
- base!=release
- -title~=(WIP|wip)
- -label~=(blocked|do-not-merge|no-squash|two-approvers)
- -merged
- -closed
- author!=dependabot[bot]
- author!=dependabot-preview[bot]
- "#approved-reviews-by>=1"
- -approved-reviews-by~=author
- "#changes-requested-reviews-by=0"
- status-success~=AWS CodeBuild us-east-1
- name: automatic merge (no-squash)
actions:
comment:
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)).
merge:
strict: smart
# Merge instead of squash
method: merge
strict_method: merge
commit_message: title+body
conditions:
- -title~=(WIP|wip)
- -label~=(blocked|do-not-merge)
# Only if no-squash is set
- label~=no-squash
- -merged
- -closed
- author!=dependabot[bot]
- author!=dependabot-preview[bot]
- "#approved-reviews-by>=1"
- -approved-reviews-by~=author
- "#changes-requested-reviews-by=0"
- status-success~=AWS CodeBuild us-east-1
19 changes: 19 additions & 0 deletions .github/workflows/auto-approve.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Approve PRs with "pr/auto-approve". mergify takes care of the actual merge.

name: auto-approve
on:
pull_request:
types: [ labeled, unlabeled, opened, synchronize, reopened, ready_for_review, review_requested ]

jobs:
auto-approve:
if: >
contains(github.event.pull_request.labels.*.name, 'pr/auto-approve') &&
(github.event.pull_request.user.login == 'aws-solutions-constructs-team'
|| github.event.pull_request.user.login == 'dependabot[bot]'
|| github.event.pull_request.user.login == 'dependabot-preview[bot]')
runs-on: ubuntu-latest
steps:
- uses: hmarr/[email protected]
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
2 changes: 1 addition & 1 deletion .viperlightignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ source/patterns/@aws-solutions-constructs/aws-apigateway-iot/test/integ.defaultP
source/patterns/@aws-solutions-constructs/aws-apigateway-iot/test/integ.overrideParams.expected.json:269
source/patterns/@aws-solutions-constructs/aws-apigateway-iot/test/test.apigateway-iot.test.ts:29
source/patterns/@aws-solutions-constructs/aws-apigateway-iot/test/integ.override_auth_api_keys.expected.json:267
source/patterns/@aws-solutions-constructs/aws-cloudfront-s3/test/test.cloudfront-s3.test.ts:110
source/patterns/@aws-solutions-constructs/aws-cloudfront-s3/test/test.cloudfront-s3.test.ts:111
source/patterns/@aws-solutions-constructs/core/test/cloudfront-distribution-s3-helper.test.ts:164
source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/test.s3-sqs.test.ts:251
source/use_cases/aws-custom-glue-etl/stream-producer/generate_data.py:86
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

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.

## [1.100.0](https://github.com/awslabs/aws-solutions-constructs/compare/v1.99.0...v1.100.0) (2021-04-28)

### Changed
- Upgraded all patterns to CDK v1.100.0
- BREAKING CHANGE: Fixed issue with refreshing Integration Tests leaving Resources Behind in Account ([#164](https://github.com/awslabs/aws-solutions-constructs/pull/164))

## [1.99.0](https://github.com/awslabs/aws-solutions-constructs/compare/v1.98.0...v1.99.0) (2021-04-22)

### Changed
Expand Down
2 changes: 1 addition & 1 deletion source/lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
"./patterns/@aws-solutions-constructs/*"
],
"rejectCycles": "true",
"version": "1.99.0"
"version": "1.100.0"
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ _Parameters_

| **Name** | **Type** | **Description** |
|:-------------|:----------------|-----------------|
|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.|
|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. |
|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.|
|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|
|insertHttpSecurityHeaders?|`boolean`|Optional user provided props to turn on/off the automatic injection of best practice HTTP security headers in all responses from CloudFront|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ export class CloudFrontToS3 extends Construct {
super(scope, id);
let bucket: s3.Bucket;

if (props.existingBucketObj && props.bucketProps) {
throw new Error('Cannot specify both bucket properties and an existing bucket');
}

if (!props.existingBucketObj) {
[this.s3Bucket, this.s3LoggingBucket] = defaults.buildS3Bucket(this, {
bucketProps: props.bucketProps
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,10 @@ const app = new App();
const stack = new Stack(app, 'test-cloudfront-s3-existing-bucket-stack');

let mybucket: s3.Bucket;
mybucket = defaults.CreateScrapBucket(stack, {});
mybucket = defaults.CreateScrapBucket(stack, { removalPolicy: RemovalPolicy.DESTROY });

const _construct = new CloudFrontToS3(stack, 'test-cloudfront-s3', {
existingBucketObj: mybucket,
bucketProps: {
removalPolicy: RemovalPolicy.DESTROY,
}
});

// Add Cache Policy
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import * as cdk from "@aws-cdk/core";
import * as s3 from '@aws-cdk/aws-s3';
import '@aws-cdk/assert/jest';
import * as acm from '@aws-cdk/aws-certificatemanager';
import { RemovalPolicy } from '@aws-cdk/core';

function deploy(stack: cdk.Stack) {
return new CloudFrontToS3(stack, 'test-cloudfront-s3', {
Expand Down Expand Up @@ -200,3 +201,25 @@ test('check properties', () => {
expect(construct.cloudFrontWebDistribution !== null);
expect(construct.s3Bucket !== null);
});

// --------------------------------------------------------------
// Test bad call with existingBucket and bucketProps
// --------------------------------------------------------------
test("Test bad call with existingBucket and bucketProps", () => {
// Stack
const stack = new cdk.Stack();

const testBucket = new s3.Bucket(stack, 'test-bucket', {});

const app = () => {
// Helper declaration
new CloudFrontToS3(stack, "bad-s3-args", {
existingBucketObj: testBucket,
bucketProps: {
removalPolicy: RemovalPolicy.DESTROY
},
});
};
// Assertion
expect(app).toThrowError();
});
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ _Parameters_
|:-------------|:----------------|-----------------|
|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.|
|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|
|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.|
|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. |
|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.|
|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.|

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ export class EventsRuleToKinesisFirehoseToS3 extends Construct {
constructor(scope: Construct, id: string, props: EventsRuleToKinesisFirehoseToS3Props) {
super(scope, id);

if (props.existingBucketObj && props.bucketProps) {
throw new Error('Cannot specify both bucket properties and an existing bucket');
}

// Set up the Kinesis Firehose using KinesisFirehoseToS3 construct
const firehoseToS3 = new KinesisFirehoseToS3(this, 'KinesisFirehoseToS3', {
kinesisFirehoseProps: props.kinesisFirehoseProps,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

import { SynthUtils } from '@aws-cdk/assert';
import * as cdk from "@aws-cdk/core";
import * as s3 from "@aws-cdk/aws-s3";
import * as events from "@aws-cdk/aws-events";
import '@aws-cdk/assert/jest';
import {EventsRuleToKinesisFirehoseToS3, EventsRuleToKinesisFirehoseToS3Props} from '../lib';
Expand Down Expand Up @@ -123,4 +124,30 @@ test('Test property override', () => {
SizeInMBs: 55
}
}});
});

// --------------------------------------------------------------
// Test bad call with existingBucket and bucketProps
// --------------------------------------------------------------
test("Test bad call with existingBucket and bucketProps", () => {
// Stack
const stack = new cdk.Stack();

const testBucket = new s3.Bucket(stack, 'test-bucket', {});

const app = () => {
// Helper declaration
new EventsRuleToKinesisFirehoseToS3(stack, "bad-s3-args", {
eventRuleProps: {
description: 'event rule props',
schedule: events.Schedule.rate(cdk.Duration.minutes(5))
},
existingBucketObj: testBucket,
bucketProps: {
removalPolicy: cdk.RemovalPolicy.DESTROY
},
});
};
// Assertion
expect(app).toThrowError();
});
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ _Parameters_
|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|
|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|
|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.|
|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.|
|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. |
|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.|

## Pattern Properties
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ export class IotToKinesisFirehoseToS3 extends Construct {
constructor(scope: Construct, id: string, props: IotToKinesisFirehoseToS3Props) {
super(scope, id);

if (props.existingBucketObj && props.bucketProps) {
throw new Error('Cannot specify both bucket properties and an existing bucket');
}

const firehoseToS3 = new KinesisFirehoseToS3(this, 'KinesisFirehoseToS3', {
kinesisFirehoseProps: props.kinesisFirehoseProps,
existingBucketObj: props.existingBucketObj,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import { SynthUtils } from '@aws-cdk/assert';
import { IotToKinesisFirehoseToS3, IotToKinesisFirehoseToS3Props } from "../lib";
import * as cdk from "@aws-cdk/core";
import * as s3 from "@aws-cdk/aws-s3";
import '@aws-cdk/assert/jest';

function deploy(stack: cdk.Stack) {
Expand Down Expand Up @@ -130,3 +131,33 @@ test('check properties', () => {
expect(construct.kinesisFirehoseLogGroup !== null);
expect(construct.s3LoggingBucket !== null);
});

// --------------------------------------------------------------
// Test bad call with existingBucket and bucketProps
// --------------------------------------------------------------
test("Test bad call with existingBucket and bucketProps", () => {
// Stack
const stack = new cdk.Stack();

const testBucket = new s3.Bucket(stack, 'test-bucket', {});

const app = () => {
// Helper declaration
new IotToKinesisFirehoseToS3(stack, "bad-s3-args", {
iotTopicRuleProps: {
topicRulePayload: {
ruleDisabled: false,
description: "Persistent storage of connected vehicle telematics data",
sql: "SELECT * FROM 'connectedcar/telemetry/#'",
actions: []
}
},
existingBucketObj: testBucket,
bucketProps: {
removalPolicy: cdk.RemovalPolicy.DESTROY
},
});
};
// Assertion
expect(app).toThrowError();
});
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ _Parameters_
|:-------------|:----------------|-----------------|
|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.|
|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.|
|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.|
|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. |
|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.|
|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.|

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ export class KinesisFirehoseToAnalyticsAndS3 extends Construct {
constructor(scope: Construct, id: string, props: KinesisFirehoseToAnalyticsAndS3Props) {
super(scope, id);

if (props.existingBucketObj && props.bucketProps) {
throw new Error('Cannot specify both bucket properties and an existing bucket');
}

// Setup the kinesisfirehose-s3 pattern
const kinesisFirehoseToS3Props: KinesisFirehoseToS3Props = {
kinesisFirehoseProps: props.kinesisFirehoseProps,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
// Imports
import { SynthUtils } from '@aws-cdk/assert';
import { Stack, RemovalPolicy } from '@aws-cdk/core';
import * as s3 from '@aws-cdk/aws-s3';
import { KinesisFirehoseToAnalyticsAndS3, KinesisFirehoseToAnalyticsAndS3Props } from '../lib';
import '@aws-cdk/assert/jest';

Expand Down Expand Up @@ -143,4 +144,26 @@ test('test kinesisFirehose override ', () => {
SizeInMBs: 55
}
}});
});

// --------------------------------------------------------------
// Test bad call with existingBucket and bucketProps
// --------------------------------------------------------------
test("Test bad call with existingBucket and bucketProps", () => {
// Stack
const stack = new Stack();

const testBucket = new s3.Bucket(stack, 'test-bucket', {});

const app = () => {
// Helper declaration
new KinesisFirehoseToAnalyticsAndS3(stack, "bad-s3-args", {
existingBucketObj: testBucket,
bucketProps: {
removalPolicy: RemovalPolicy.DESTROY
},
});
};
// Assertion
expect(app).toThrowError();
});
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ _Parameters_
| **Name** | **Type** | **Description** |
|:-------------|:----------------|-----------------|
|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.|
|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.|
|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. |
|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.|
|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.|
|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.|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ export class KinesisFirehoseToS3 extends Construct {

let bucket: s3.IBucket;

if (props.existingBucketObj && props.bucketProps) {
throw new Error('Cannot specify both bucket properties and an existing bucket');
}

// Setup S3 Bucket
if (!props.existingBucketObj) {
let { bucketProps } = props;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,3 +192,25 @@ test('check for no SSE encryption for KinesisFirehoseToS3', () => {
},
});
});

// --------------------------------------------------------------
// Test bad call with existingBucket and bucketProps
// --------------------------------------------------------------
test("Test bad call with existingBucket and bucketProps", () => {
// Stack
const stack = new cdk.Stack();

const testBucket = new s3.Bucket(stack, 'test-bucket', {});

const app = () => {
// Helper declaration
new KinesisFirehoseToS3(stack, "bad-s3-args", {
existingBucketObj: testBucket,
bucketProps: {
removalPolicy: cdk.RemovalPolicy.DESTROY
},
});
};
// Assertion
expect(app).toThrowError();
});
Loading

0 comments on commit b8033aa

Please sign in to comment.