From 9632c2fa0488a035ae400920c0cc23b698b60a05 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Wed, 12 Oct 2022 21:24:29 +0000 Subject: [PATCH] chore: version updates, including breaking changes in jsii (backport #22382) (#22464) This is an automatic backport of pull request #22382 done by [Mergify](https://mergify.com). Cherry-pick of f169d7f73d7ee4b7165299ae45399438393f7463 has failed: ``` On branch mergify/bp/v1-main/pr-22382 Your branch is up to date with 'origin/v1-main'. You are currently cherry-picking commit f169d7f73d. (fix conflicts and run "git cherry-pick --continue") (use "git cherry-pick --skip" to skip this patch) (use "git cherry-pick --abort" to cancel the cherry-pick operation) Changes to be committed: modified: packages/@aws-cdk/aws-certificatemanager/lambda-packages/dns_validated_certificate_handler/package.json modified: packages/@aws-cdk/aws-cloudformation/package.json modified: packages/@aws-cdk/aws-dynamodb/package.json modified: packages/@aws-cdk/aws-ec2/package.json modified: packages/@aws-cdk/aws-ec2/test/vpn.test.ts modified: packages/@aws-cdk/aws-iam/package.json modified: packages/@aws-cdk/aws-lambda-nodejs/package.json modified: packages/@aws-cdk/aws-lambda/package.json modified: packages/@aws-cdk/aws-logs/package.json modified: packages/@aws-cdk/aws-route53/package.json modified: packages/@aws-cdk/aws-s3/package.json modified: packages/@aws-cdk/aws-ses/package.json modified: packages/@aws-cdk/custom-resources/package.json modified: tools/@aws-cdk/cdk-build-tools/lib/deprecated-symbols.ts Unmerged paths: (use "git add/rm ..." as appropriate to mark resolution) both modified: package.json both modified: packages/@aws-cdk/aws-apigatewayv2-authorizers/package.json both modified: packages/@aws-cdk/aws-ec2/lib/vpc.ts both modified: packages/@aws-cdk/aws-ec2/test/vpc.test.ts both modified: packages/@aws-cdk/aws-eks/package.json both modified: packages/@aws-cdk/cloudformation-diff/package.json both modified: packages/@aws-cdk/core/package.json both modified: packages/@aws-cdk/custom-resources/test/aws-custom-resource/aws-custom-resource.test.ts deleted by us: packages/@aws-cdk/custom-resources/test/aws-custom-resource/integ.aws-custom-resource-vpc.ts both modified: packages/@aws-cdk/integ-runner/THIRD_PARTY_LICENSES both modified: packages/@aws-cdk/integ-runner/package.json both modified: packages/@aws-cdk/integ-tests/package.json both modified: packages/@monocdk-experiment/assert/package.json both modified: packages/@monocdk-experiment/rewrite-imports/package.json both modified: packages/aws-cdk-lib/package.json both modified: packages/aws-cdk-migration/package.json both modified: packages/aws-cdk/THIRD_PARTY_LICENSES both modified: packages/aws-cdk/package.json both modified: packages/awslint/package.json both modified: packages/cdk-assets/package.json both modified: packages/cdk-cli-wrapper/package.json both modified: packages/cdk-dasm/package.json both modified: packages/monocdk/package.json both modified: tools/@aws-cdk/cdk-build-tools/package.json both modified: tools/@aws-cdk/cfn2ts/package.json both modified: tools/@aws-cdk/eslint-plugin/package.json both modified: tools/@aws-cdk/node-bundle/package.json both modified: tools/@aws-cdk/prlint/package.json both modified: tools/@aws-cdk/yarn-cling/package.json both modified: yarn.lock ``` To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/github/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally ---
Mergify commands and options
More conditions and actions can be found in the [documentation](https://docs.mergify.com/). You can also trigger Mergify actions by commenting on this pull request: - `@Mergifyio refresh` will re-evaluate the rules - `@Mergifyio rebase` will rebase this PR on its base branch - `@Mergifyio update` will merge the base branch into this PR - `@Mergifyio backport ` will backport this PR on `` branch Additionally, on Mergify [dashboard](https://dashboard.mergify.com/) you can: - look at your merge queues - generate the Mergify configuration with the config editor. Finally, you can contact us on https://mergify.com
--- packages/@aws-cdk/aws-ec2/lib/vpc.ts | 2 +- packages/@aws-cdk/aws-ec2/test/vpc.test.ts | 9 ++- packages/@aws-cdk/aws-ec2/test/vpn.test.ts | 60 ++++++++++++++----- .../aws-custom-resource.test.ts | 2 +- .../cdk-build-tools/lib/deprecated-symbols.ts | 15 +++++ 5 files changed, 65 insertions(+), 23 deletions(-) diff --git a/packages/@aws-cdk/aws-ec2/lib/vpc.ts b/packages/@aws-cdk/aws-ec2/lib/vpc.ts index 8de4ffa3c6889..e40f93df33ed9 100644 --- a/packages/@aws-cdk/aws-ec2/lib/vpc.ts +++ b/packages/@aws-cdk/aws-ec2/lib/vpc.ts @@ -2190,7 +2190,7 @@ function determineNatGatewayCount(requestedCount: number | undefined, subnetConf if (count === 0 && hasPrivateSubnets) { // eslint-disable-next-line max-len - throw new Error('If you do not want NAT gateways (natGateways=0), make sure you don\'t configure any PRIVATE subnets in \'subnetConfiguration\' (make them PUBLIC or ISOLATED instead)'); + throw new Error('If you do not want NAT gateways (natGateways=0), make sure you don\'t configure any PRIVATE(_WITH_NAT) subnets in \'subnetConfiguration\' (make them PUBLIC or ISOLATED instead)'); } if (count > 0 && !hasPublicSubnets) { diff --git a/packages/@aws-cdk/aws-ec2/test/vpc.test.ts b/packages/@aws-cdk/aws-ec2/test/vpc.test.ts index 4fff089d78f62..0e6f19c18525a 100644 --- a/packages/@aws-cdk/aws-ec2/test/vpc.test.ts +++ b/packages/@aws-cdk/aws-ec2/test/vpc.test.ts @@ -31,7 +31,7 @@ import { describe('vpc', () => { describe('When creating a VPC', () => { - test('SubnetType.PRIVATE is equivalent to SubnetType.PRIVATE_WITH_NAT', () => { + testDeprecated('SubnetType.PRIVATE is equivalent to SubnetType.PRIVATE_WITH_NAT', () => { const stack1 = getTestStack(); const stack2 = getTestStack(); @@ -68,7 +68,7 @@ describe('vpc', () => { }); - test('SubnetType.ISOLATED is equivalent to SubnetType.PRIVATE_ISOLATED', () => { + testDeprecated('SubnetType.ISOLATED is equivalent to SubnetType.PRIVATE_ISOLATED', () => { const stack1 = getTestStack(); const stack2 = getTestStack(); @@ -89,7 +89,6 @@ describe('vpc', () => { }, ], }); - const t1 = Template.fromStack(stack1); const t2 = Template.fromStack(stack2); @@ -706,7 +705,7 @@ describe('vpc', () => { }); - test('natGateways = 0 throws if no PRIVATE subnets configured', () => { + testDeprecated('natGateways = 0 throws if PRIVATE_WITH_NAT subnets configured', () => { const stack = getTestStack(); expect(() => { new Vpc(stack, 'VPC', { @@ -722,7 +721,7 @@ describe('vpc', () => { }, ], }); - }).toThrow(/make sure you don't configure any PRIVATE subnets/); + }).toThrow(/make sure you don't configure any PRIVATE/); }); diff --git a/packages/@aws-cdk/aws-ec2/test/vpn.test.ts b/packages/@aws-cdk/aws-ec2/test/vpn.test.ts index 9e3c1968b384d..76ba6053ed31e 100644 --- a/packages/@aws-cdk/aws-ec2/test/vpn.test.ts +++ b/packages/@aws-cdk/aws-ec2/test/vpn.test.ts @@ -1,4 +1,5 @@ import { Template } from '@aws-cdk/assertions'; +import { testDeprecated } from '@aws-cdk/cdk-build-tools'; import { Duration, SecretValue, Stack, Token } from '@aws-cdk/core'; import { PublicSubnet, Vpc, VpnConnection } from '../lib'; @@ -84,7 +85,7 @@ describe('vpn', () => { }); - test.each([false, true])('with tunnel options, using secret: %p', (secret) => { + test('with tunnel options, using secret value', () => { // GIVEN const stack = new Stack(); @@ -92,17 +93,44 @@ describe('vpn', () => { vpnConnections: { VpnConnection: { ip: '192.0.2.1', - tunnelOptions: [ - secret - ? { - preSharedKeySecret: SecretValue.unsafePlainText('secretkey1234'), - tunnelInsideCidr: '169.254.10.0/30', - } - : { - preSharedKey: 'secretkey1234', - tunnelInsideCidr: '169.254.10.0/30', - }, - ], + tunnelOptions: [{ + preSharedKeySecret: SecretValue.unsafePlainText('secretkey1234'), + tunnelInsideCidr: '169.254.10.0/30', + }], + }, + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::EC2::VPNConnection', { + CustomerGatewayId: { + Ref: 'VpcNetworkVpnConnectionCustomerGateway8B56D9AF', + }, + Type: 'ipsec.1', + VpnGatewayId: { + Ref: 'VpcNetworkVpnGateway501295FA', + }, + StaticRoutesOnly: false, + VpnTunnelOptionsSpecifications: [ + { + PreSharedKey: 'secretkey1234', + TunnelInsideCidr: '169.254.10.0/30', + }, + ], + }); + }); + + testDeprecated('with tunnel options, using secret', () => { + // GIVEN + const stack = new Stack(); + + new Vpc(stack, 'VpcNetwork', { + vpnConnections: { + VpnConnection: { + ip: '192.0.2.1', + tunnelOptions: [{ + preSharedKey: 'secretkey1234', + tunnelInsideCidr: '169.254.10.0/30', + }], }, }, }); @@ -150,13 +178,13 @@ describe('vpn', () => { ip: '192.0.2.1', tunnelOptions: [ { - preSharedKey: 'secretkey1234', + preSharedKeySecret: SecretValue.unsafePlainText('secretkey1234'), }, { - preSharedKey: 'secretkey1234', + preSharedKeySecret: SecretValue.unsafePlainText('secretkey1234'), }, { - preSharedKey: 'secretkey1234', + preSharedKeySecret: SecretValue.unsafePlainText('secretkey1234'), }, ], }, @@ -189,7 +217,7 @@ describe('vpn', () => { }); - test('fails when specifying an invalid pre-shared key', () => { + testDeprecated('fails when specifying an invalid pre-shared key', () => { // GIVEN const stack = new Stack(); diff --git a/packages/@aws-cdk/custom-resources/test/aws-custom-resource/aws-custom-resource.test.ts b/packages/@aws-cdk/custom-resources/test/aws-custom-resource/aws-custom-resource.test.ts index c3df398f6f5dd..fccbf06985a05 100644 --- a/packages/@aws-cdk/custom-resources/test/aws-custom-resource/aws-custom-resource.test.ts +++ b/packages/@aws-cdk/custom-resources/test/aws-custom-resource/aws-custom-resource.test.ts @@ -742,4 +742,4 @@ test('assumedRoleArn adds statement for sts:assumeRole', () => { Version: '2012-10-17', }, }); -}); \ No newline at end of file +}); diff --git a/tools/@aws-cdk/cdk-build-tools/lib/deprecated-symbols.ts b/tools/@aws-cdk/cdk-build-tools/lib/deprecated-symbols.ts index d64f3b4e1f5c3..1e4c4db16567e 100644 --- a/tools/@aws-cdk/cdk-build-tools/lib/deprecated-symbols.ts +++ b/tools/@aws-cdk/cdk-build-tools/lib/deprecated-symbols.ts @@ -37,6 +37,21 @@ export function testDeprecated(name: string, fn: () => any, timeout?: number) { }, timeout); } +export declare namespace testDeprecated { + const each: typeof test.each; +} + +(testDeprecated as any).each = function(cases: ReadonlyArray>) { + const testRunner = (test.each as any).call(test, cases); + return (name: string, fn: (...testArgs: any[]) => any) => { + testRunner(name, (...testArgs: any[]) => { + const deprecated = DeprecatedSymbols.quiet(); + fn(...testArgs); + DeprecatedSymbols.reset(deprecated); + }); + }; +}; + namespace DeprecatedSymbols { export function quiet(): string | undefined { const deprecated = process.env.JSII_DEPRECATED;