Skip to content

Commit

Permalink
Merge branch 'master' into issue11296
Browse files Browse the repository at this point in the history
  • Loading branch information
pgarbe committed Apr 1, 2021
2 parents 6aef3cb + aefc241 commit c7a95fb
Show file tree
Hide file tree
Showing 50 changed files with 350 additions and 198 deletions.
2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,8 @@
"standard-version": "^9.1.1",
"typescript": "~3.9.9"
},
"netmask-resolutions-comment": "transitive dep from proxy-agent@4.0.1. review when dependencies upgrade",
"tap-mocha-reporter-resolutions-comment": "should be removed or reviewed when nodeunit dependency is dropped or adjusted",
"resolutions": {
"netmask": "2.0.1",
"tap-mocha-reporter": "^5.0.1"
},
"repository": {
Expand Down
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
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,5 @@
},
"dependencies": {
"@aws-cdk/core": "%cdk-version%"
},
"resolutions": {
"netmask": "2.0.1"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,5 @@
"dependencies": {
"@aws-cdk/core": "%cdk-version%",
"source-map-support": "^0.5.16"
},
"resolutions": {
"netmask": "2.0.1"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,5 @@
},
"dependencies": {
"@aws-cdk/core": "%cdk-version%"
},
"resolutions": {
"netmask": "2.0.1"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,5 @@
"@aws-cdk/aws-sns-subscriptions": "%cdk-version%",
"@aws-cdk/aws-sqs": "%cdk-version%",
"@aws-cdk/core": "%cdk-version%"
},
"resolutions": {
"netmask": "2.0.1"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,5 @@
"@aws-cdk/aws-sns-subscriptions": "%cdk-version%",
"@aws-cdk/aws-sqs": "%cdk-version%",
"@aws-cdk/core": "%cdk-version%"
},
"resolutions": {
"netmask": "2.0.1"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,5 @@
"dependencies": {
"aws-cdk-lib": "%cdk-version%",
"constructs": "^3.0.4"
},
"resolutions": {
"netmask": "2.0.1"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,5 @@
"aws-cdk-lib": "%cdk-version%",
"constructs": "^3.0.4",
"source-map-support": "^0.5.16"
},
"resolutions": {
"netmask": "2.0.1"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,5 @@
"dependencies": {
"aws-cdk-lib": "%cdk-version%",
"constructs": "^3.0.4"
},
"resolutions": {
"netmask": "2.0.1"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,5 @@
"dependencies": {
"aws-cdk-lib": "%cdk-version%",
"constructs": "^3.0.4"
},
"resolutions": {
"netmask": "2.0.1"
}
}
Loading

0 comments on commit c7a95fb

Please sign in to comment.