Skip to content

Commit 9070271

Browse files
Merge branch 'main' into iotAuditConfiguration
2 parents 4cf2a90 + 218e0af commit 9070271

42 files changed

Lines changed: 25651 additions & 23859 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@
4141
"colors": "1.4.0",
4242
"markdown-it": "^12.3.2",
4343
"string-width": "^4.2.3",
44-
"@types/babel__traverse": "7.18.2"
44+
"@types/babel__traverse": "7.18.2",
45+
"@smithy/types": "3.5.0"
4546
},
4647
"repository": {
4748
"type": "git",

packages/@aws-cdk-testing/cli-integ/lib/aws.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {
33
DeleteStackCommand,
44
DescribeStacksCommand,
55
UpdateTerminationProtectionCommand,
6-
Stack,
6+
type Stack,
77
} from '@aws-sdk/client-cloudformation';
88
import { DeleteRepositoryCommand, ECRClient } from '@aws-sdk/client-ecr';
99
import { ECSClient } from '@aws-sdk/client-ecs';
@@ -13,14 +13,14 @@ import {
1313
S3Client,
1414
DeleteObjectsCommand,
1515
ListObjectVersionsCommand,
16-
ObjectIdentifier,
16+
type ObjectIdentifier,
1717
DeleteBucketCommand,
1818
} from '@aws-sdk/client-s3';
1919
import { SNSClient } from '@aws-sdk/client-sns';
2020
import { SSOClient } from '@aws-sdk/client-sso';
2121
import { STSClient, GetCallerIdentityCommand } from '@aws-sdk/client-sts';
2222
import { fromIni } from '@aws-sdk/credential-providers';
23-
import { AwsCredentialIdentityProvider } from '@smithy/types';
23+
import type { AwsCredentialIdentityProvider } from '@smithy/types';
2424
import { ConfiguredRetryStrategy } from '@smithy/util-retry';
2525
interface ClientConfig {
2626
readonly credentials?: AwsCredentialIdentityProvider;
@@ -75,7 +75,7 @@ export class AwsClients {
7575
maxAttempts: 2,
7676
});
7777

78-
return (await stsClient.send(new GetCallerIdentityCommand())).Account!;
78+
return (await stsClient.send(new GetCallerIdentityCommand({}))).Account!;
7979
}
8080

8181
public async deleteStacks(...stackNames: string[]) {

packages/@aws-cdk-testing/cli-integ/lib/with-cdk-app.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,11 @@ interface CommonCdkBootstrapCommandOptions {
258258
* @default - none
259259
*/
260260
readonly tags?: string;
261+
262+
/**
263+
* @default - the default CDK qualifier
264+
*/
265+
readonly qualifier?: string;
261266
}
262267

263268
export interface CdkLegacyBootstrapCommandOptions extends CommonCdkBootstrapCommandOptions {
@@ -408,7 +413,7 @@ export class TestFixture extends ShellHelper {
408413
if (options.bootstrapBucketName) {
409414
args.push('--bootstrap-bucket-name', options.bootstrapBucketName);
410415
}
411-
args.push('--qualifier', this.qualifier);
416+
args.push('--qualifier', options.qualifier ?? this.qualifier);
412417
if (options.cfnExecutionPolicy) {
413418
args.push('--cloudformation-execution-policies', options.cfnExecutionPolicy);
414419
}

packages/@aws-cdk-testing/cli-integ/package.json

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -39,19 +39,19 @@
3939
},
4040
"dependencies": {
4141
"@octokit/rest": "^18.12.0",
42-
"@aws-sdk/client-codeartifact": "3.637.0",
43-
"@aws-sdk/client-cloudformation": "3.637.0",
44-
"@aws-sdk/client-ecr": "3.637.0",
45-
"@aws-sdk/client-ecs": "3.637.0",
46-
"@aws-sdk/client-iam": "3.637.0",
47-
"@aws-sdk/client-lambda": "3.637.0",
48-
"@aws-sdk/client-s3": "3.637.0",
49-
"@aws-sdk/client-sns": "3.637.0",
50-
"@aws-sdk/client-sso": "3.637.0",
51-
"@aws-sdk/client-sts": "3.637.0",
52-
"@aws-sdk/credential-providers": "3.637.0",
53-
"@smithy/util-retry": "3.0.4",
54-
"@smithy/types": "3.4.0",
42+
"@aws-sdk/client-codeartifact": "3.632.0",
43+
"@aws-sdk/client-cloudformation": "3.632.0",
44+
"@aws-sdk/client-ecr": "3.632.0",
45+
"@aws-sdk/client-ecs": "3.632.0",
46+
"@aws-sdk/client-iam": "3.632.0",
47+
"@aws-sdk/client-lambda": "3.632.0",
48+
"@aws-sdk/client-s3": "3.632.0",
49+
"@aws-sdk/client-sns": "3.632.0",
50+
"@aws-sdk/client-sso": "3.632.0",
51+
"@aws-sdk/client-sts": "3.632.0",
52+
"@aws-sdk/credential-providers": "3.632.0",
53+
"@smithy/util-retry": "3.0.7",
54+
"@smithy/types": "3.5.0",
5555
"axios": "^1.7.7",
5656
"chalk": "^4",
5757
"fs-extra": "^9.1.0",

packages/@aws-cdk-testing/cli-integ/resources/cdk-apps/app/app.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -438,9 +438,17 @@ class IamRolesStack extends cdk.Stack {
438438
// Environment variabile is used to create a bunch of roles to test
439439
// that large diff templates are uploaded to S3 to create the changeset.
440440
for(let i = 1; i <= Number(process.env.NUMBER_OF_ROLES) ; i++) {
441-
new iam.Role(this, `Role${i}`, {
441+
const role = new iam.Role(this, `Role${i}`, {
442442
assumedBy: new iam.ServicePrincipal('lambda.amazonaws.com'),
443443
});
444+
const cfnRole = role.node.defaultChild;
445+
446+
// For any extra IAM roles created, add a ton of metadata so that the template size is > 50 KiB.
447+
if (i > 1) {
448+
for(let i = 1; i <= 30 ; i++) {
449+
cfnRole.addMetadata('a'.repeat(1000), 'v');
450+
}
451+
}
444452
}
445453
}
446454
}
@@ -792,6 +800,7 @@ switch (stackSet) {
792800

793801
new LambdaStack(app, `${stackPrefix}-lambda`);
794802

803+
// This stack is used to test diff with large templates by creating a role with a ton of metadata
795804
new IamRolesStack(app, `${stackPrefix}-iam-roles`);
796805

797806
if (process.env.ENABLE_VPC_TESTING == 'IMPORT') {

packages/@aws-cdk-testing/cli-integ/tests/cli-integ-tests/cli.integtest.ts

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1034,18 +1034,18 @@ integTest(
10341034
integTest(
10351035
'cdk diff with large changeset does not fail',
10361036
withDefaultFixture(async (fixture) => {
1037-
// GIVEN - small initial stack with only ane IAM role
1037+
// GIVEN - small initial stack with only one IAM role
10381038
await fixture.cdkDeploy('iam-roles', {
10391039
modEnv: {
10401040
NUMBER_OF_ROLES: '1',
10411041
},
10421042
});
10431043

1044-
// WHEN - adding 200 roles to the same stack to create a large diff
1044+
// WHEN - adding an additional role with a ton of metadata to create a large diff
10451045
const diff = await fixture.cdk(['diff', fixture.fullStackName('iam-roles')], {
10461046
verbose: true,
10471047
modEnv: {
1048-
NUMBER_OF_ROLES: '200',
1048+
NUMBER_OF_ROLES: '2',
10491049
},
10501050
});
10511051

@@ -1055,6 +1055,40 @@ integTest(
10551055
}),
10561056
);
10571057

1058+
integTest('cdk diff with large changeset and custom toolkit stack name and qualifier does not fail', withoutBootstrap(async (fixture) => {
1059+
// Bootstrapping with custom toolkit stack name and qualifier
1060+
const qualifier = 'abc1111';
1061+
const toolkitStackName = 'custom-stack2';
1062+
await fixture.cdkBootstrapModern({
1063+
verbose: true,
1064+
toolkitStackName: toolkitStackName,
1065+
qualifier: qualifier,
1066+
});
1067+
1068+
// Deploying small initial stack with only one IAM role
1069+
await fixture.cdkDeploy('iam-roles', {
1070+
modEnv: {
1071+
NUMBER_OF_ROLES: '1',
1072+
},
1073+
options: [
1074+
'--toolkit-stack-name', toolkitStackName,
1075+
'--context', `@aws-cdk/core:bootstrapQualifier=${qualifier}`,
1076+
],
1077+
});
1078+
1079+
// WHEN - adding a role with a ton of metadata to create a large diff
1080+
const diff = await fixture.cdk(['diff', '--toolkit-stack-name', toolkitStackName, '--context', `@aws-cdk/core:bootstrapQualifier=${qualifier}`, fixture.fullStackName('iam-roles')], {
1081+
verbose: true,
1082+
modEnv: {
1083+
NUMBER_OF_ROLES: '2',
1084+
},
1085+
});
1086+
1087+
// Assert that the CLI assumes the file publishing role:
1088+
expect(diff).toMatch(/Assuming role .*file-publishing-role/);
1089+
expect(diff).toContain('success: Published');
1090+
}));
1091+
10581092
integTest(
10591093
'cdk diff --security-only successfully outputs sso-permission-set-without-managed-policy information',
10601094
withDefaultFixture(async (fixture) => {

packages/@aws-cdk-testing/framework-integ/package.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@
3232
"@aws-cdk/cdk-build-tools": "0.0.0",
3333
"@aws-cdk/integ-runner": "^0.0.0",
3434
"@aws-cdk/pkglint": "0.0.0",
35-
"@aws-sdk/client-acm": "3.421.0",
36-
"@aws-sdk/client-rds": "3.421.0",
37-
"@aws-sdk/client-s3": "3.421.0",
35+
"@aws-sdk/client-acm": "3.632.0",
36+
"@aws-sdk/client-rds": "3.632.0",
37+
"@aws-sdk/client-s3": "3.632.0",
3838
"delay": "5.0.0"
3939
},
4040
"dependencies": {
@@ -43,7 +43,6 @@
4343
"@aws-cdk/lambda-layer-kubectl-v29": "^2.1.0",
4444
"@aws-cdk/lambda-layer-kubectl-v30": "^2.0.1",
4545
"aws-cdk-lib": "0.0.0",
46-
"aws-sdk-mock": "5.6.0",
4746
"cdk8s": "2.69.0",
4847
"cdk8s-plus-27": "2.9.5",
4948
"constructs": "^10.0.0"

packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.delete-existing-record-set.js.snapshot/Rooute53DeleteExistingRecordSetIntegDefaultTestDeployAssert62638412.assets.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.delete-existing-record-set.js.snapshot/asset.e0e799a729f2e647a95d0ba4e1b63e93839a8f3034bfcb17ba52ea561cafba19/__entrypoint__.js renamed to packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.delete-existing-record-set.js.snapshot/asset.782a34c2ce2f5bc5e5b90304f41348680a6f9ba7a0eb2de6f03658640f67ff15/__entrypoint__.js

File renamed without changes.

packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.delete-existing-record-set.js.snapshot/asset.782a34c2ce2f5bc5e5b90304f41348680a6f9ba7a0eb2de6f03658640f67ff15/index.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)