Skip to content

Commit

Permalink
Merge branch 'main' into r53-gw
Browse files Browse the repository at this point in the history
  • Loading branch information
mickychetta committed Jan 5, 2022
2 parents dbbac6a + b8a3d12 commit 18344f1
Show file tree
Hide file tree
Showing 438 changed files with 2,745 additions and 3,189 deletions.
16 changes: 8 additions & 8 deletions .viperlightignore
Original file line number Diff line number Diff line change
Expand Up @@ -145,11 +145,11 @@ source/patterns/@aws-solutions-constructs/aws-alb-lambda/README.md:35
source/patterns/@aws-solutions-constructs/aws-alb-lambda/test/alb-lambda.test.ts:27
source/patterns/@aws-solutions-constructs/aws-alb-lambda/test/alb-lambda.test.ts:680
# These are references to the us-east-1 ELBV2 account (publicly known)
source/patterns/@aws-solutions-constructs/aws-route53-alb/test/integ.deployPrivateApi.expected.json:193
source/patterns/@aws-solutions-constructs/aws-route53-alb/test/integ.deployPrivateApiExistingZone.expected.json:844
source/patterns/@aws-solutions-constructs/aws-route53-alb/test/integ.deployPublicApiNewAlb.expected.json:188
source/patterns/@aws-solutions-constructs/aws-alb-lambda/test/integ.privateApiNewResources.expected.json:196
source/patterns/@aws-solutions-constructs/aws-alb-lambda/test/integ.publicApiNewResources.expected.json:199
source/patterns/@aws-solutions-constructs/aws-alb-lambda/test/integ.twoTargets.expected.json:199
source/patterns/@aws-solutions-constructs/aws-alb-lambda/test/integ.privateApiExistingResources.expected.json:1058
source/patterns/@aws-solutions-constructs/aws-alb-lambda/test/integ.publicApiExistingResources.expected.json:1058
source/patterns/@aws-solutions-constructs/aws-route53-alb/test/integ.deployPrivateApi.expected.json:192
source/patterns/@aws-solutions-constructs/aws-route53-alb/test/integ.deployPrivateApiExistingZone.expected.json:849
source/patterns/@aws-solutions-constructs/aws-route53-alb/test/integ.deployPublicApiNewAlb.expected.json:187
source/patterns/@aws-solutions-constructs/aws-alb-lambda/test/integ.privateApiNewResources.expected.json:195
source/patterns/@aws-solutions-constructs/aws-alb-lambda/test/integ.publicApiNewResources.expected.json:198
source/patterns/@aws-solutions-constructs/aws-alb-lambda/test/integ.twoTargets.expected.json:198
source/patterns/@aws-solutions-constructs/aws-alb-lambda/test/integ.privateApiExistingResources.expected.json:1063
source/patterns/@aws-solutions-constructs/aws-alb-lambda/test/integ.publicApiExistingResources.expected.json:1063
59 changes: 59 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,65 @@

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.136.0](https://github.com/awslabs/aws-solutions-constructs/compare/v1.135.0...v1.136.0) (2021-12-20)

* Upgraded all patterns to CDK v1.136.0
* Set underlying CDK library to 2.2.0

## [1.135.0](https://github.com/awslabs/aws-solutions-constructs/compare/v1.134.0...v1.135.0) (2021-12-17)

* Upgraded all patterns to CDK v1.135.0

## [1.134.0](https://github.com/awslabs/aws-solutions-constructs/compare/v1.133.0...v1.134.0) (2021-12-17)

* Upgraded all patterns to CDK v1.134.0

### Features

* **s3-stepfunctions:** removed CloudTrail dependency after new S3 feature ([#529](https://github.com/awslabs/aws-solutions-constructs/issues/529)) ([639f473](https://github.com/awslabs/aws-solutions-constructs/commit/639f47396f868846a81d0f81b6eb8160c61c6ae3))

## [1.133.0](https://github.com/awslabs/aws-solutions-constructs/compare/v1.132.0...v1.133.0) (2021-12-16)

* Upgraded all patterns to CDK v1.133.0

## [1.132.0](https://github.com/awslabs/aws-solutions-constructs/compare/v1.131.0...v1.132.0) (2021-12-16)

* Upgraded all patterns to CDK v1.132.0

## [1.131.0](https://github.com/awslabs/aws-solutions-constructs/compare/v1.130.0...v1.131.0) (2021-12-15)

* Upgraded all patterns to CDK v1.131.0

## [1.130.0](https://github.com/awslabs/aws-solutions-constructs/compare/v2.0.0...v1.130.0) (2021-12-15)

* Upgraded all patterns to CDK v1.130.0
* Changed underlying CDK 2.0 release to R26

## [1.129.0](https://github.com/awslabs/aws-solutions-constructs/compare/v1.128.0...v1.129.0) (2021-11-28)

* Upgraded all patterns to CDK v1.129.0

## [1.128.0](https://github.com/awslabs/aws-solutions-constructs/compare/v1.127.0...v1.128.0) (2021-11-28)

* Upgraded all patterns to CDK v1.128.0

## [1.127.0](https://github.com/awslabs/aws-solutions-constructs/compare/v2.0.0-rc.2...v1.127.0) (2021-11-28)

* Upgraded all patterns to CDK v1.127.0

### Features

* **aws-cloudfront-s3:** added logS3AccessLogs prop ([#506](https://github.com/awslabs/aws-solutions-constructs/issues/506)) ([6d3c7c9](https://github.com/awslabs/aws-solutions-constructs/commit/6d3c7c94dbe1398fc2eef16a7862704bb15a8bb9))
* **aws-events-rule-kinesisfirehose-s3:** added logS3AccessLogs and loggingBucketProps ([#492](https://github.com/awslabs/aws-solutions-constructs/issues/492)) ([0af95f5](https://github.com/awslabs/aws-solutions-constructs/commit/0af95f58c395f766d29d1ece791d0307621f63e6))
* **aws-iot-kinesisfirehose-s3:** added custom loggingBucketProps ([#480](https://github.com/awslabs/aws-solutions-constructs/issues/480)) ([76c0aa9](https://github.com/awslabs/aws-solutions-constructs/commit/76c0aa9ed4be859319a830d29be1a397b3322a43))
* **aws-kinesisfirehose-s3-and-kinesisanalytics:** added logS3AccessLogs and loggingBucketProps ([#490](https://github.com/awslabs/aws-solutions-constructs/issues/490)) ([3d8fec6](https://github.com/awslabs/aws-solutions-constructs/commit/3d8fec6632c76711ee26c323893ca5a7a58d917f))
* **aws-kinesisfirehose-s3:** added custom logging bucket props to kinesisfirehose-s3 ([#478](https://github.com/awslabs/aws-solutions-constructs/issues/478)) ([6fab3e5](https://github.com/awslabs/aws-solutions-constructs/commit/6fab3e50de4ef73d2e9f2dbde358d9d6f14e9831))
* **aws-kinesisstreams-gluejob:** encrypted bucket in existing job integ test ([#504](https://github.com/awslabs/aws-solutions-constructs/issues/504)) ([04d0642](https://github.com/awslabs/aws-solutions-constructs/commit/04d06424663b3f7cb5cc4ef6a9995f5eedce1721))
* **aws-kinesisstreams-kinesisfirehose-s3:** added loggingBucketProps and logS3AccessLogs ([#493](https://github.com/awslabs/aws-solutions-constructs/issues/493)) ([85b5f7a](https://github.com/awslabs/aws-solutions-constructs/commit/85b5f7ada3e197dcc83a1ad1bd9e23efedf9f63e))
* **aws-lambda-s3:** added logS3AccessLogs and updated tests ([#496](https://github.com/awslabs/aws-solutions-constructs/issues/496)) ([9922938](https://github.com/awslabs/aws-solutions-constructs/commit/992293810b92b3272e08e6b408c868243007049e))
* **aws-s3-sqs:** added logS3AccessLogs and S3BucketInterface ([#499](https://github.com/awslabs/aws-solutions-constructs/issues/499)) ([c8320bd](https://github.com/awslabs/aws-solutions-constructs/commit/c8320bdd9cc47e519556a40b2a2e7f163922edc7))
* **aws-s3-stepfunctions:** added logS3AccessLogs and S3BucketInterface ([#500](https://github.com/awslabs/aws-solutions-constructs/issues/500)) ([d7d10f6](https://github.com/awslabs/aws-solutions-constructs/commit/d7d10f683e74276e1f737db8fbac434e0b48cd5e))

## [1.126.0](https://github.com/awslabs/aws-solutions-constructs/compare/v2.0.0-rc.1...v1.126.0) (2021-10-25)

* Upgraded all patterns to CDK v1.126.0
Expand Down
22 changes: 22 additions & 0 deletions CHANGELOG.v2.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,28 @@

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.

## [2.0.0](https://github.com/awslabs/aws-solutions-constructs/compare/v2.0.0-rc.2...v2.0.0) (2021-12-02)

* Includes all funcionality of V1.129.0

### Features

* **aws-cloudfront-s3:** added logS3AccessLogs prop ([#506](https://github.com/awslabs/aws-solutions-constructs/issues/506)) ([6d3c7c9](https://github.com/awslabs/aws-solutions-constructs/commit/6d3c7c94dbe1398fc2eef16a7862704bb15a8bb9))
* **aws-events-rule-kinesisfirehose-s3:** added logS3AccessLogs and loggingBucketProps ([#492](https://github.com/awslabs/aws-solutions-constructs/issues/492)) ([0af95f5](https://github.com/awslabs/aws-solutions-constructs/commit/0af95f58c395f766d29d1ece791d0307621f63e6))
* **aws-iot-kinesisfirehose-s3:** added custom loggingBucketProps ([#480](https://github.com/awslabs/aws-solutions-constructs/issues/480)) ([76c0aa9](https://github.com/awslabs/aws-solutions-constructs/commit/76c0aa9ed4be859319a830d29be1a397b3322a43))
* **aws-kinesisfirehose-s3-and-kinesisanalytics:** added logS3AccessLogs and loggingBucketProps ([#490](https://github.com/awslabs/aws-solutions-constructs/issues/490)) ([3d8fec6](https://github.com/awslabs/aws-solutions-constructs/commit/3d8fec6632c76711ee26c323893ca5a7a58d917f))
* **aws-kinesisfirehose-s3:** added custom logging bucket props to kinesisfirehose-s3 ([#478](https://github.com/awslabs/aws-solutions-constructs/issues/478)) ([6fab3e5](https://github.com/awslabs/aws-solutions-constructs/commit/6fab3e50de4ef73d2e9f2dbde358d9d6f14e9831))
* **aws-kinesisstreams-gluejob:** encrypted bucket in existing job integ test ([#504](https://github.com/awslabs/aws-solutions-constructs/issues/504)) ([04d0642](https://github.com/awslabs/aws-solutions-constructs/commit/04d06424663b3f7cb5cc4ef6a9995f5eedce1721))
* **aws-kinesisstreams-kinesisfirehose-s3:** added loggingBucketProps and logS3AccessLogs ([#493](https://github.com/awslabs/aws-solutions-constructs/issues/493)) ([85b5f7a](https://github.com/awslabs/aws-solutions-constructs/commit/85b5f7ada3e197dcc83a1ad1bd9e23efedf9f63e))
* **aws-lambda-s3:** added logS3AccessLogs and updated tests ([#496](https://github.com/awslabs/aws-solutions-constructs/issues/496)) ([9922938](https://github.com/awslabs/aws-solutions-constructs/commit/992293810b92b3272e08e6b408c868243007049e))
* **aws-s3-sqs:** added logS3AccessLogs and S3BucketInterface ([#499](https://github.com/awslabs/aws-solutions-constructs/issues/499)) ([c8320bd](https://github.com/awslabs/aws-solutions-constructs/commit/c8320bdd9cc47e519556a40b2a2e7f163922edc7))
* **aws-s3-stepfunctions:** added logS3AccessLogs and S3BucketInterface ([#500](https://github.com/awslabs/aws-solutions-constructs/issues/500)) ([d7d10f6](https://github.com/awslabs/aws-solutions-constructs/commit/d7d10f683e74276e1f737db8fbac434e0b48cd5e))


### Bug Fixes

* **Update reference from existingBucketInterface to existingBucketObj:** Update Documentation [#520](https://github.com/awslabs/aws-solutions-constructs/issues/520) ([0c030e8](https://github.com/awslabs/aws-solutions-constructs/commit/0c030e82a83ffffd61b0ede90b379e7903008ab8))

## [2.0.0-rc.2](https://github.com/awslabs/aws-solutions-constructs/compare/v2.0.0-rc.1...v2.0.0-rc.2) (2021-11-02)

### Features
Expand Down
3 changes: 2 additions & 1 deletion DESIGN_GUIDELINES.md
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,8 @@ Existing Inconsistencies would not be published, that’s for our internal use

| Name | Type | Notes |
| --- | --- | --- |
| existingBucketObj? | s3.Bucket | Either this or bucketProps must be provided |
| existingBucketObj? | s3.Bucket | Either this, existingBucketInterface or bucketProps must be provided |
| existingBucketInterface? | s3.IBucket | Either this, existingBucketObject or bucketProps must be provided |
| bucketProps? | s3.BucketProps | |
| s3EventTypes? | s3.EventType | Only required when construct responds to S3 events |
| s3EventFilters? | s3.NotificationKeyFilter |Only required when construct responds to S3 events |
Expand Down
2 changes: 1 addition & 1 deletion deployment/v2/align-version.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const findVersion = process.argv[2];
const replaceVersion = process.argv[3];

// these versions need to be sourced from a config file
const awsCdkLibVersion = '2.0.0-rc.23';
const awsCdkLibVersion = '2.2.0';
const constructsVersion = '10.0.0';
const MODULE_EXEMPTIONS = new Set([
'@aws-cdk/cloudformation-diff',
Expand Down
21 changes: 11 additions & 10 deletions deployment/v2/build-patterns.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,17 @@ echo "==========================================================================
echo "aligning versions and updating package.json for CDK v2..."
/bin/bash $deployment_dir/align-version.sh

bail="--bail"
runtarget="build+lint+test"
cd $source_dir/

export PATH=$(npm bin):$PATH
export NODE_OPTIONS="--max-old-space-size=4096 ${NODE_OPTIONS:-}"

echo "============================================================================================="
echo "installing..."
yarn install --frozen-lockfile

echo "============================================================================================="
echo "updating Import statements for CDK v2..."
/bin/bash $deployment_dir/rewrite-imports.sh
Expand All @@ -18,18 +29,8 @@ cd $source_dir/tools/cdk-integ-tools
npm install
npm run build
npm link

bail="--bail"
runtarget="build+lint+test"
cd $source_dir/

export PATH=$(npm bin):$PATH
export NODE_OPTIONS="--max-old-space-size=4096 ${NODE_OPTIONS:-}"

echo "============================================================================================="
echo "installing..."
yarn install --frozen-lockfile

echo "============================================================================================="
echo "building..."
time lerna run $bail --stream $runtarget || fail
Expand Down
12 changes: 0 additions & 12 deletions deployment/v2/rewrite-imports.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,6 @@ set -euo pipefail
deployment_dir=$(cd $(dirname $0) && pwd)
source_dir="$deployment_dir/../../source"

if [ ! -d $source_dir/tools/aws-cdk-migration/node_modules ]; then
echo "============================================================================================="
echo "building aws-cdk-migration..."
cd $source_dir/tools/aws-cdk-migration
npm install
npm run build
npm link
else
cd $source_dir/tools/aws-cdk-migration
npm link
fi

cd $source_dir/

if [ $# -eq 0 ]; then
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.126.0"
"version": "1.136.0"
}
2 changes: 1 addition & 1 deletion source/lerna.v2.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
"./patterns/@aws-solutions-constructs/*"
],
"rejectCycles": "true",
"version": "2.0.0-rc.2"
"version": "2.2.0"
}
7 changes: 4 additions & 3 deletions source/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@
"eslint-plugin-license-header": "^0.2.0",
"fs-extra": "^8.1.0",
"jest": "^26.6.0",
"jsii": "^1.11.0",
"jsii-pacmak": "^1.11.0",
"jsii": "^1.49.0",
"jsii-pacmak": "^1.49.0",
"tslint": "^5.20.1",
"typescript": "~3.9.7"
"typescript": "~3.9.7",
"aws-cdk-migration": "^1.135.0"
},
"devDependencies": {
"lerna": "^3.22.1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Here is a minimal deployable pattern definition in Typescript:
const props: AlbToLambdaProps = {
lambdaFunctionProps: {
code: lambda.Code.fromAsset(`${__dirname}/lambda`),
runtime: lambda.Runtime.NODEJS_12_X,
runtime: lambda.Runtime.NODEJS_14_X,
handler: 'index.handler'
},
listenerProps: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import * as lambda from "@aws-cdk/aws-lambda";
import { Construct } from "@aws-cdk/core";
import * as defaults from "@aws-solutions-constructs/core";
import { CfnListener, CfnTargetGroup } from "@aws-cdk/aws-elasticloadbalancingv2";
import { GetActiveListener } from "@aws-solutions-constructs/core";

export interface AlbToLambdaProps {
/**
Expand Down Expand Up @@ -199,56 +200,41 @@ export class AlbToLambda extends Construct {
vpc: this.vpc,
});

let newListener: boolean;
if (this.loadBalancer.listeners.length === 0) {
// This is a new listener, we need to create it along with the default target
const newTargetGroup = defaults.CreateLambdaTargetGroup(this,
`tg${this.loadBalancer.listeners.length + 1}`,
this.lambdaFunction,
props.targetProps);
newListener = true;
} else {
newListener = false;
}

// If there's no listener, then we add one here
if (newListener) {
this.listener = defaults.AddListener(
this,
this.loadBalancer,
newTargetGroup,
props.listenerProps
);
// Testing occasionally caused a TargetGroup not found error, this
// code ensures the Group will be complete before the Listener tries
// to access it.
const newListener = this.listener.node.defaultChild as CfnListener;
const cfnTargetGroup = newTargetGroup.node.defaultChild as CfnTargetGroup;
newListener.addDependsOn(cfnTargetGroup);
} else {
// We're adding a target to an existing listener. If this.loadBalancer.listeners.length
// is >0, then this.loadBalancer was set from existingLoadBalancer
this.listener = GetActiveListener(this.loadBalancer.listeners);
defaults.AddTarget(
this,
defaults.CreateLambdaTargetGroup(
this,
`tg${this.loadBalancer.listeners.length + 1}`,
this.lambdaFunction,
props.targetProps
),
this.listener,
props.ruleProps
);
}
}
}

function GetActiveListener(listeners: elb.ApplicationListener[]): elb.ApplicationListener {
let listener: elb.ApplicationListener;

if (listeners.length === 1 ) {
listener = listeners[0];
} else {
const correctListener = listeners.find(i => (i.node.children[0] as elb.CfnListener).protocol === "HTTPS");
if (correctListener) {
listener = correctListener;
} else {
// This line should be unreachable
throw new Error(`Two listeners in the ALB, but neither are HTTPS`);
const newTargetGroup = defaults.AddLambdaTarget(
this,
`tg${this.loadBalancer.listeners.length + 1}`,
this.listener,
this.lambdaFunction,
props.ruleProps,
props.targetProps);

// this.listener needs to be set on the construct.
// could be above: else { defaults.GetActiveListener }
// do we then move that funcionality back into the construct (not the function). If so do
// we leave it in AddNewTarget or just do it here and pass the listener?
if (newListener && this.listener) {
const levelOneListener = this.listener.node.defaultChild as CfnListener;
const cfnTargetGroup = newTargetGroup.node.defaultChild as CfnTargetGroup;
levelOneListener.addDependsOn(cfnTargetGroup);
}

}
return listener;
}
Loading

0 comments on commit 18344f1

Please sign in to comment.