Skip to content

Commit

Permalink
Merge branch 'master' into huijbers/cling-it
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] authored Mar 31, 2021
2 parents bd11a63 + 9b0a6cf commit 4ada04c
Show file tree
Hide file tree
Showing 35 changed files with 217 additions and 134 deletions.
2 changes: 1 addition & 1 deletion packages/@aws-cdk/assert/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
},
"license": "Apache-2.0",
"devDependencies": {
"@types/jest": "^26.0.21",
"@types/jest": "^26.0.22",
"cdk-build-tools": "0.0.0",
"jest": "^26.6.3",
"pkglint": "0.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"devDependencies": {
"aws-sdk": "^2.596.0",
"aws-sdk-mock": "^5.1.0",
"eslint": "^7.22.0",
"eslint": "^7.23.0",
"eslint-config-standard": "^14.1.1",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-node": "^11.1.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-cloudformation/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
"@aws-cdk/aws-sns-subscriptions": "0.0.0",
"@aws-cdk/aws-sqs": "0.0.0",
"@aws-cdk/aws-ssm": "0.0.0",
"@types/aws-lambda": "^8.10.72",
"@types/aws-lambda": "^8.10.73",
"@types/nodeunit": "^0.0.31",
"cdk-build-tools": "0.0.0",
"cdk-integ-tools": "0.0.0",
Expand Down
3 changes: 0 additions & 3 deletions packages/@aws-cdk/aws-cloudfront/lib/origin-request-policy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,6 @@ export class OriginRequestHeaderBehavior {
if (headers.length === 0) {
throw new Error('At least one header to allow must be provided');
}
if (headers.length > 10) {
throw new Error(`Maximum allowed headers in Origin Request Policy is 10; got ${headers.length}.`);
}
if (/Authorization/i.test(headers.join('|')) || /Accept-Encoding/i.test(headers.join('|'))) {
throw new Error('you cannot pass `Authorization` or `Accept-Encoding` as header values; use a CachePolicy to forward these headers instead');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,17 +89,6 @@ describe('OriginRequestPolicy', () => {
expect(() => new OriginRequestPolicy(stack, 'OriginRequestPolicy7', { headerBehavior: OriginRequestHeaderBehavior.allowList('Foo', 'Bar') })).not.toThrow();
});

test('throws if more than 10 OriginRequestHeaderBehavior headers are being passed', () => {
const errorMessage = /Maximum allowed headers in Origin Request Policy is 10; got (.*?)/;
expect(() => new OriginRequestPolicy(stack, 'OriginRequestPolicy1', {
headerBehavior: OriginRequestHeaderBehavior.allowList('Lorem', 'ipsum', 'dolor', 'sit', 'amet', 'consectetur', 'adipiscing', 'elit', 'sed', 'do', 'eiusmod'),
})).toThrow(errorMessage);

expect(() => new OriginRequestPolicy(stack, 'OriginRequestPolicy2', {
headerBehavior: OriginRequestHeaderBehavior.allowList('Lorem', 'ipsum', 'dolor', 'sit', 'amet', 'consectetur', 'adipiscing', 'elit', 'sed', 'do'),
})).not.toThrow();
});

test('does not throw if originRequestPolicyName is a token', () => {
expect(() => new OriginRequestPolicy(stack, 'CachePolicy', {
originRequestPolicyName: Aws.STACK_NAME,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"devDependencies": {
"aws-sdk": "^2.596.0",
"aws-sdk-mock": "^5.1.0",
"eslint": "^7.22.0",
"eslint": "^7.23.0",
"eslint-config-standard": "^14.1.1",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-node": "^11.1.0",
Expand Down
23 changes: 19 additions & 4 deletions packages/@aws-cdk/aws-dynamodb/lib/table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as cloudwatch from '@aws-cdk/aws-cloudwatch';
import * as iam from '@aws-cdk/aws-iam';
import * as kms from '@aws-cdk/aws-kms';
import {
Aws, CfnCondition, CfnCustomResource, CustomResource, Duration,
Aws, CfnCondition, CfnCustomResource, CfnResource, CustomResource, Duration,
Fn, IResource, Lazy, Names, RemovalPolicy, Resource, Stack, Token,
} from '@aws-cdk/core';
import { Construct } from 'constructs';
Expand Down Expand Up @@ -1477,7 +1477,8 @@ export class Table extends TableBase {
this.grant(onEventHandlerPolicy, 'dynamodb:*');
this.grant(isCompleteHandlerPolicy, 'dynamodb:DescribeTable');

let previousRegion;
let previousRegion: CustomResource | undefined;
let previousRegionCondition: CfnCondition | undefined;
for (const region of new Set(regions)) { // Remove duplicates
// Use multiple custom resources because multiple create/delete
// updates cannot be combined in a single API call.
Expand All @@ -1498,8 +1499,9 @@ export class Table extends TableBase {
// Deploy time check to prevent from creating a replica in the region
// where this stack is deployed. Only needed for environment agnostic
// stacks.
let createReplica: CfnCondition | undefined;
if (Token.isUnresolved(stack.region)) {
const createReplica = new CfnCondition(this, `StackRegionNotEquals${region}`, {
createReplica = new CfnCondition(this, `StackRegionNotEquals${region}`, {
expression: Fn.conditionNot(Fn.conditionEquals(region, Aws.REGION)),
});
const cfnCustomResource = currentRegion.node.defaultChild as CfnCustomResource;
Expand All @@ -1518,9 +1520,22 @@ export class Table extends TableBase {
// have multiple table updates at the same time. The `isCompleteHandler`
// of the provider waits until the replica is in an ACTIVE state.
if (previousRegion) {
currentRegion.node.addDependency(previousRegion);
if (previousRegionCondition) {
// we can't simply use a Dependency,
// because the previousRegion is protected by the "different region" Condition,
// and you can't have Fn::If in DependsOn.
// Instead, rely on Ref adding a dependency implicitly!
const previousRegionCfnResource = previousRegion.node.defaultChild as CfnResource;
const currentRegionCfnResource = currentRegion.node.defaultChild as CfnResource;
currentRegionCfnResource.addMetadata('DynamoDbReplicationDependency',
Fn.conditionIf(previousRegionCondition.logicalId, previousRegionCfnResource.ref, Aws.NO_VALUE));
} else {
currentRegion.node.addDependency(previousRegion);
}
}

previousRegion = currentRegion;
previousRegionCondition = createReplica;
}

// Permissions in the destination regions (outside of the loop to
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-dynamodb/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
"license": "Apache-2.0",
"devDependencies": {
"@aws-cdk/assert": "0.0.0",
"@types/jest": "^26.0.21",
"@types/jest": "^26.0.22",
"aws-sdk": "^2.848.0",
"aws-sdk-mock": "^5.1.0",
"cdk-build-tools": "0.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,14 +199,26 @@
"Region": "eu-west-3"
},
"DependsOn": [
"TableReplicauseast28A15C236",
"TableSourceTableAttachedManagedPolicyawscdkdynamodbglobalreplicasprovisionedawscdkawsdynamodbReplicaProviderIsCompleteHandlerServiceRoleBE2B1C1A5DC546D2",
"TableSourceTableAttachedManagedPolicyawscdkdynamodbglobalreplicasprovisionedawscdkawsdynamodbReplicaProviderOnEventHandlerServiceRoleD9856B771F8F2CCB",
"TableWriteScalingTargetE5669214",
"TableWriteScalingTargetTrackingD78DCCD8"
],
"UpdateReplacePolicy": "Delete",
"DeletionPolicy": "Delete",
"Metadata": {
"DynamoDbReplicationDependency": {
"Fn::If": [
"TableStackRegionNotEqualsuseast2D20A1E77",
{
"Ref": "TableReplicauseast28A15C236"
},
{
"Ref": "AWS::NoValue"
}
]
}
},
"Condition": "TableStackRegionNotEqualseuwest302B3591C"
},
"TableWriteScalingTargetE5669214": {
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-lambda-nodejs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
"cdk-build-tools": "0.0.0",
"cdk-integ-tools": "0.0.0",
"delay": "5.0.0",
"esbuild": "^0.9.6",
"esbuild": "^0.11.2",
"pkglint": "0.0.0"
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-lambda/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
"license": "Apache-2.0",
"devDependencies": {
"@aws-cdk/assert": "0.0.0",
"@types/aws-lambda": "^8.10.72",
"@types/aws-lambda": "^8.10.73",
"@types/lodash": "^4.14.168",
"cdk-build-tools": "0.0.0",
"cdk-integ-tools": "0.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-s3-deployment/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
"devDependencies": {
"@aws-cdk/assert": "0.0.0",
"@aws-cdk/cx-api": "0.0.0",
"@types/jest": "^26.0.21",
"@types/jest": "^26.0.22",
"cdk-build-tools": "0.0.0",
"cdk-integ-tools": "0.0.0",
"jest": "^26.6.3",
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-sam/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
"license": "Apache-2.0",
"devDependencies": {
"@aws-cdk/assert": "0.0.0",
"@types/jest": "^26.0.21",
"@types/jest": "^26.0.22",
"cdk-build-tools": "0.0.0",
"cfn2ts": "0.0.0",
"jest": "^26.6.3",
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/cdk-assets-schema/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
},
"license": "Apache-2.0",
"devDependencies": {
"@types/jest": "^26.0.21",
"@types/jest": "^26.0.22",
"cdk-build-tools": "0.0.0",
"jest": "^26.6.3",
"pkglint": "0.0.0"
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/cloud-assembly-schema/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
},
"license": "Apache-2.0",
"devDependencies": {
"@types/jest": "^26.0.21",
"@types/jest": "^26.0.22",
"@types/mock-fs": "^4.13.0",
"cdk-build-tools": "0.0.0",
"jest": "^26.6.3",
Expand Down
4 changes: 2 additions & 2 deletions packages/@aws-cdk/cloudformation-diff/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@
"diff": "^5.0.0",
"fast-deep-equal": "^3.1.3",
"string-width": "^4.2.2",
"table": "^6.0.7"
"table": "^6.0.9"
},
"devDependencies": {
"@types/jest": "^26.0.21",
"@types/jest": "^26.0.22",
"@types/string-width": "^4.0.1",
"@types/table": "^6.0.0",
"cdk-build-tools": "0.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/cloudformation-include/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@
},
"devDependencies": {
"@aws-cdk/assert": "0.0.0",
"@types/jest": "^26.0.21",
"@types/jest": "^26.0.22",
"cdk-build-tools": "0.0.0",
"cdk-integ-tools": "0.0.0",
"jest": "^26.6.3",
Expand Down
4 changes: 2 additions & 2 deletions packages/@aws-cdk/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,8 @@
"license": "Apache-2.0",
"devDependencies": {
"@types/lodash": "^4.14.168",
"@types/minimatch": "^3.0.3",
"@types/node": "^10.17.55",
"@types/minimatch": "^3.0.4",
"@types/node": "^10.17.56",
"@types/sinon": "^9.0.11",
"cdk-build-tools": "0.0.0",
"cfn2ts": "0.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/custom-resources/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
"@aws-cdk/aws-events": "0.0.0",
"@aws-cdk/aws-s3": "0.0.0",
"@aws-cdk/aws-ssm": "0.0.0",
"@types/aws-lambda": "^8.10.72",
"@types/aws-lambda": "^8.10.73",
"@types/fs-extra": "^8.1.1",
"@types/sinon": "^9.0.11",
"aws-sdk": "^2.848.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/cx-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
},
"license": "Apache-2.0",
"devDependencies": {
"@types/jest": "^26.0.21",
"@types/jest": "^26.0.22",
"@types/mock-fs": "^4.13.0",
"@types/semver": "^7.3.4",
"cdk-build-tools": "0.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/yaml-cfn/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
},
"devDependencies": {
"@aws-cdk/assert": "0.0.0",
"@types/jest": "^26.0.21",
"@types/jest": "^26.0.22",
"@types/yaml": "^1.9.7",
"cdk-build-tools": "0.0.0",
"jest": "^26.6.3",
Expand Down
4 changes: 2 additions & 2 deletions packages/@monocdk-experiment/assert/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
"license": "Apache-2.0",
"devDependencies": {
"@monocdk-experiment/rewrite-imports": "0.0.0",
"@types/jest": "^26.0.21",
"@types/node": "^10.17.55",
"@types/jest": "^26.0.22",
"@types/node": "^10.17.56",
"cdk-build-tools": "0.0.0",
"constructs": "^3.3.69",
"jest": "^26.6.3",
Expand Down
4 changes: 2 additions & 2 deletions packages/@monocdk-experiment/rewrite-imports/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
},
"devDependencies": {
"@types/glob": "^7.1.3",
"@types/jest": "^26.0.21",
"@types/node": "^10.17.55",
"@types/jest": "^26.0.22",
"@types/node": "^10.17.56",
"cdk-build-tools": "0.0.0",
"pkglint": "0.0.0"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/aws-cdk-lib/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@
"@aws-cdk/region-info": "0.0.0",
"@aws-cdk/yaml-cfn": "0.0.0",
"@types/fs-extra": "^8.1.1",
"@types/node": "^10.17.55",
"@types/node": "^10.17.56",
"cdk-build-tools": "0.0.0",
"constructs": "^3.3.69",
"fs-extra": "^9.1.0",
Expand Down
10 changes: 5 additions & 5 deletions packages/aws-cdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@
"license": "Apache-2.0",
"devDependencies": {
"@aws-cdk/core": "0.0.0",
"@octokit/rest": "^18.3.5",
"@octokit/rest": "^18.5.2",
"@types/archiver": "^5.1.0",
"@types/fs-extra": "^8.1.1",
"@types/glob": "^7.1.3",
"@types/jest": "^26.0.21",
"@types/minimatch": "^3.0.3",
"@types/jest": "^26.0.22",
"@types/minimatch": "^3.0.4",
"@types/mockery": "^1.4.29",
"@types/node": "^10.17.55",
"@types/node": "^10.17.56",
"@types/promptly": "^3.0.1",
"@types/semver": "^7.3.4",
"@types/sinon": "^9.0.11",
Expand Down Expand Up @@ -86,7 +86,7 @@
"proxy-agent": "^4.0.1",
"semver": "^7.3.5",
"source-map-support": "^0.5.19",
"table": "^6.0.7",
"table": "^6.0.9",
"uuid": "^8.3.2",
"wrap-ansi": "^7.0.0",
"yargs": "^16.2.0"
Expand Down
4 changes: 2 additions & 2 deletions packages/cdk-assets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@
"devDependencies": {
"@types/archiver": "^5.1.0",
"@types/glob": "^7.1.3",
"@types/jest": "^26.0.21",
"@types/jest": "^26.0.22",
"@types/jszip": "^3.4.1",
"@types/mock-fs": "^4.13.0",
"@types/node": "^10.17.55",
"@types/node": "^10.17.56",
"@types/yargs": "^15.0.13",
"cdk-build-tools": "0.0.0",
"jest": "^26.6.3",
Expand Down
2 changes: 1 addition & 1 deletion packages/cdk-dasm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"yaml": "1.10.2"
},
"devDependencies": {
"@types/jest": "^26.0.21",
"@types/jest": "^26.0.22",
"@types/yaml": "1.9.7",
"jest": "^26.6.3"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/decdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@
},
"devDependencies": {
"@types/fs-extra": "^8.1.1",
"@types/jest": "^26.0.21",
"@types/jest": "^26.0.22",
"@types/yaml": "1.9.7",
"@types/yargs": "^15.0.13",
"jest": "^26.6.3",
Expand Down
2 changes: 1 addition & 1 deletion packages/monocdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@
"@aws-cdk/region-info": "0.0.0",
"@aws-cdk/yaml-cfn": "0.0.0",
"@types/fs-extra": "^8.1.1",
"@types/node": "^10.17.55",
"@types/node": "^10.17.56",
"cdk-build-tools": "0.0.0",
"constructs": "^3.3.69",
"fs-extra": "^9.1.0",
Expand Down
8 changes: 4 additions & 4 deletions tools/cdk-build-tools/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,16 @@
"license": "Apache-2.0",
"devDependencies": {
"@types/fs-extra": "^8.1.1",
"@types/jest": "^26.0.21",
"@types/jest": "^26.0.22",
"@types/yargs": "^15.0.13",
"pkglint": "0.0.0"
},
"dependencies": {
"@typescript-eslint/eslint-plugin": "^4.19.0",
"@typescript-eslint/parser": "^4.19.0",
"@typescript-eslint/eslint-plugin": "^4.20.0",
"@typescript-eslint/parser": "^4.20.0",
"awslint": "0.0.0",
"colors": "^1.4.0",
"eslint": "^7.22.0",
"eslint": "^7.23.0",
"eslint-import-resolver-node": "^0.3.4",
"eslint-import-resolver-typescript": "^2.4.0",
"eslint-plugin-cdk": "0.0.0",
Expand Down
2 changes: 1 addition & 1 deletion tools/cfn2ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
},
"devDependencies": {
"@types/fs-extra": "^8.1.1",
"@types/jest": "^26.0.21",
"@types/jest": "^26.0.22",
"@types/yargs": "^15.0.13",
"cdk-build-tools": "0.0.0",
"jest": "^26.6.3",
Expand Down
Loading

0 comments on commit 4ada04c

Please sign in to comment.