aws-cdk 2.1118.3 → 2.1119.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.js CHANGED
@@ -3601,7 +3601,7 @@ var require_semver2 = __commonJS({
3601
3601
  // ../@aws-cdk/cloud-assembly-schema/cli-version.json
3602
3602
  var require_cli_version = __commonJS({
3603
3603
  "../@aws-cdk/cloud-assembly-schema/cli-version.json"(exports2, module2) {
3604
- module2.exports = { version: "2.1118.3" };
3604
+ module2.exports = { version: "2.1119.0" };
3605
3605
  }
3606
3606
  });
3607
3607
 
@@ -4032,14 +4032,14 @@ have a unique display name. (Default - no display name)`,
4032
4032
  {
4033
4033
  type: "array",
4034
4034
  items: {
4035
- $ref: "#/definitions/Tag"
4036
- }
4037
- },
4038
- {
4039
- description: "Type of creation stack data",
4040
- type: "array",
4041
- items: {
4042
- type: "string"
4035
+ anyOf: [
4036
+ {
4037
+ $ref: "#/definitions/Tag"
4038
+ },
4039
+ {
4040
+ type: "string"
4041
+ }
4042
+ ]
4043
4043
  }
4044
4044
  },
4045
4045
  {
@@ -5638,7 +5638,7 @@ var require_integ_schema = __commonJS({
5638
5638
  var require_version = __commonJS({
5639
5639
  "../@aws-cdk/cloud-assembly-schema/schema/version.json"(exports2, module2) {
5640
5640
  module2.exports = {
5641
- schemaHash: "794dc834654646b4a60c6d8ea46ed0245a71de33e598289f6922082951768d04",
5641
+ schemaHash: "cf2452236640f556f1b81778515335af1c6bbdb54c7ef12dad43f8cf6a56ddee",
5642
5642
  $comment: "Do not hold back the version on additions: jsonschema validation of the manifest by the consumer will trigger errors on unexpected fields.",
5643
5643
  revision: 53
5644
5644
  };
@@ -128243,6 +128243,7 @@ __export(cfn_api_exports, {
128243
128243
  stabilizeStack: () => stabilizeStack,
128244
128244
  uploadStackTemplateAssets: () => uploadStackTemplateAssets,
128245
128245
  waitForChangeSet: () => waitForChangeSet,
128246
+ waitForChangeSetGone: () => waitForChangeSetGone,
128246
128247
  waitForStackDelete: () => waitForStackDelete,
128247
128248
  waitForStackDeploy: () => waitForStackDeploy
128248
128249
  });
@@ -128305,6 +128306,26 @@ async function waitForChangeSet(cfn, ioHelper, stackName, changeSetName, { fetch
128305
128306
  }
128306
128307
  return ret;
128307
128308
  }
128309
+ async function waitForChangeSetGone(cfn, ioHelper, stackName, changeSetName) {
128310
+ await ioHelper.defaults.debug((0, import_util10.format)("Waiting for changeset %s on stack %s to finish deleting...", changeSetName, stackName));
128311
+ await waitFor(async () => {
128312
+ try {
128313
+ const description = await cfn.describeChangeSet({
128314
+ StackName: stackName,
128315
+ ChangeSetName: changeSetName
128316
+ });
128317
+ if (description.Status === import_client_cloudformation2.ChangeSetStatus.DELETE_COMPLETE || description.Status === import_client_cloudformation2.ChangeSetStatus.DELETE_FAILED) {
128318
+ return true;
128319
+ }
128320
+ return void 0;
128321
+ } catch (e6) {
128322
+ if (e6.name === "ChangeSetNotFoundException") {
128323
+ return true;
128324
+ }
128325
+ throw e6;
128326
+ }
128327
+ });
128328
+ }
128308
128329
  async function createDiffChangeSet(ioHelper, options) {
128309
128330
  return uploadBodyParameterAndCreateChangeSet(ioHelper, {
128310
128331
  ...options,
@@ -128501,6 +128522,7 @@ var init_cfn_api = __esm({
128501
128522
  __name(describeChangeSet, "describeChangeSet");
128502
128523
  __name(waitFor, "waitFor");
128503
128524
  __name(waitForChangeSet, "waitForChangeSet");
128525
+ __name(waitForChangeSetGone, "waitForChangeSetGone");
128504
128526
  __name(createDiffChangeSet, "createDiffChangeSet");
128505
128527
  __name(templatesFromAssetManifestArtifact, "templatesFromAssetManifestArtifact");
128506
128528
  __name(uploadBodyParameterAndCreateChangeSet, "uploadBodyParameterAndCreateChangeSet");
@@ -129004,7 +129026,7 @@ var init_filter = __esm({
129004
129026
  const matched = ands.map((affected) => actualComponents.filter((actual) => this.componentNameMatches(affected, actual) && semver3.satisfies(actual.version, affected.version, { includePrerelease: true })));
129005
129027
  if (matched.every((xs) => xs.length > 0)) {
129006
129028
  const ret = new FilteredNotice(notice);
129007
- this.addDynamicValues(matched.flatMap((x6) => x6), ret);
129029
+ this.addDynamicValues(matched.flatMap((x6) => x6), ret, notice.dynamicValues);
129008
129030
  return [ret];
129009
129031
  }
129010
129032
  }
@@ -129024,9 +129046,9 @@ var init_filter = __esm({
129024
129046
  * Adds dynamic values from the given ActualComponents
129025
129047
  *
129026
129048
  * If there are multiple components with the same dynamic name, they are joined
129027
- * by a comma.
129049
+ * by the separator declared in `specs[name].separator`, defaulting to `','`.
129028
129050
  */
129029
- addDynamicValues(comps, notice) {
129051
+ addDynamicValues(comps, notice, specs) {
129030
129052
  const dynamicValues = {};
129031
129053
  for (const comp of comps) {
129032
129054
  if (comp.dynamicName) {
@@ -129035,7 +129057,7 @@ var init_filter = __esm({
129035
129057
  }
129036
129058
  }
129037
129059
  for (const [key, values] of Object.entries(dynamicValues)) {
129038
- notice.addDynamicValue(key, values.join(","));
129060
+ notice.addDynamicValue(key, values.join(specs?.[key]?.separator ?? ","));
129039
129061
  }
129040
129062
  }
129041
129063
  /**
@@ -142392,16 +142414,19 @@ var init_early_validation = __esm({
142392
142414
  "../@aws-cdk/toolkit-lib/lib/api/deployments/early-validation.ts"() {
142393
142415
  "use strict";
142394
142416
  EarlyValidationReporter = class {
142395
- constructor(sdk, envResources) {
142417
+ constructor(sdk, envResources, ioHelper) {
142396
142418
  this.sdk = sdk;
142397
142419
  this.envResources = envResources;
142420
+ this.ioHelper = ioHelper;
142398
142421
  }
142399
142422
  sdk;
142400
142423
  envResources;
142424
+ ioHelper;
142401
142425
  static {
142402
142426
  __name(this, "EarlyValidationReporter");
142403
142427
  }
142404
142428
  async fetchDetails(changeSetName, stackName) {
142429
+ const summary = `Early validation failed for stack '${stackName}' (ChangeSet '${changeSetName}')`;
142405
142430
  let operationEvents = [];
142406
142431
  try {
142407
142432
  operationEvents = await this.getFailedEvents(stackName, changeSetName);
@@ -142411,12 +142436,12 @@ var init_early_validation = __esm({
142411
142436
  currentVersion = (await this.envResources.lookupToolkit()).version;
142412
142437
  } catch (e6) {
142413
142438
  }
142414
- return `The template cannot be deployed because of early validation errors, but retrieving more details about those
142415
- errors failed (${error4}). Make sure you have permissions to call the DescribeEvents API, or re-bootstrap
142416
- your environment by running 'cdk bootstrap' to update the Bootstrap CDK Toolkit stack.
142417
- Bootstrap toolkit stack version 30 or later is needed; current version: ${currentVersion ?? "unknown"}.`;
142439
+ await this.ioHelper.defaults.warn(
142440
+ `Could not retrieve additional details about early validation errors (${error4}). Make sure you have permissions to call the DescribeEvents API, or re-bootstrap your environment by running 'cdk bootstrap' to update the Bootstrap CDK Toolkit stack. Bootstrap toolkit stack version 30 or later is needed; current version: ${currentVersion ?? "unknown"}.`
142441
+ );
142442
+ return summary;
142418
142443
  }
142419
- let message2 = `ChangeSet '${changeSetName}' on stack '${stackName}' failed early validation`;
142444
+ let message2 = summary;
142420
142445
  if (operationEvents.length > 0) {
142421
142446
  const failures = operationEvents.map((event) => ` - ${event.ValidationStatusReason} (at ${event.ValidationPath})`).join("\n");
142422
142447
  message2 += `:
@@ -142837,7 +142862,7 @@ var init_deploy_stack = __esm({
142837
142862
  await this.ioHelper.defaults.debug((0, import_util32.format)("Initiated creation of changeset: %s; waiting for it to finish creating...", changeSet.Id));
142838
142863
  const environmentResourcesRegistry = new EnvironmentResourcesRegistry();
142839
142864
  const envResources = environmentResourcesRegistry.for(this.options.resolvedEnvironment, this.options.sdk, this.ioHelper);
142840
- const validationReporter = new EarlyValidationReporter(this.options.sdk, envResources);
142865
+ const validationReporter = new EarlyValidationReporter(this.options.sdk, envResources, this.ioHelper);
142841
142866
  try {
142842
142867
  return await waitForChangeSet(this.cfn, this.ioHelper, this.stackName, changeSetName, {
142843
142868
  fetchAll: willExecute,
@@ -142904,6 +142929,7 @@ var init_deploy_stack = __esm({
142904
142929
  StackName: this.stackName,
142905
142930
  ChangeSetName: changeSetName
142906
142931
  });
142932
+ await waitForChangeSetGone(this.cfn, this.ioHelper, this.stackName, changeSetName);
142907
142933
  }
142908
142934
  }
142909
142935
  async updateTerminationProtection() {
@@ -310324,8 +310350,8 @@ var init_importer = __esm({
310324
310350
  cfnDiff = __toESM(require_lib10());
310325
310351
  chalk16 = __toESM(require_source());
310326
310352
  fs31 = __toESM(require_lib4());
310327
- init_toolkit_error();
310328
310353
  init_deployments2();
310354
+ init_diff3();
310329
310355
  init_private();
310330
310356
  ResourceImporter = class {
310331
310357
  static {
@@ -310433,13 +310459,9 @@ var init_importer = __esm({
310433
310459
  const resourceChanges = Object.entries(diff.resources.changes).filter(([logicalId, _2]) => logicalId !== "CDKMetadata");
310434
310460
  const nonAdditions = resourceChanges.filter(([_2, dif]) => !dif.isAddition);
310435
310461
  const additions = resourceChanges.filter(([_2, dif]) => dif.isAddition);
310436
- if (nonAdditions.length) {
310462
+ if (nonAdditions.length && allowNonAdditions) {
310437
310463
  const offendingResources = nonAdditions.map(([logId, _2]) => this.describeResource(logId));
310438
- if (allowNonAdditions) {
310439
- await this.ioHelper.defaults.warn(`Ignoring updated/deleted resources (--force): ${offendingResources.join(", ")}`);
310440
- } else {
310441
- throw new ToolkitError("ImportNonAdditionChanges", `No resource updates or deletes are allowed on import operation. Make sure to resolve pending changes to existing resources, before attempting an import. Updated/deleted resources: ${offendingResources.join(", ")} (--force to override)`);
310442
- }
310464
+ await this.ioHelper.defaults.warn(`Ignoring updated/deleted resources (--force): ${offendingResources.join(", ")}`);
310443
310465
  }
310444
310466
  return {
310445
310467
  additions: additions.map(([logicalId, resourceDiff]) => ({
@@ -310447,7 +310469,14 @@ var init_importer = __esm({
310447
310469
  resourceDiff,
310448
310470
  resourceDefinition: addDefaultDeletionPolicy(this.stack.template?.Resources?.[logicalId] ?? {})
310449
310471
  })),
310450
- hasNonAdditions: nonAdditions.length > 0
310472
+ hasNonAdditions: nonAdditions.length > 0,
310473
+ nonAdditionNames: nonAdditions.map(([logId, _2]) => this.describeResource(logId)),
310474
+ diffFormatter: new DiffFormatter({
310475
+ templateInfo: {
310476
+ oldTemplate: currentTemplate,
310477
+ newTemplate: this.stack
310478
+ }
310479
+ })
310451
310480
  };
310452
310481
  }
310453
310482
  /**
@@ -311455,6 +311484,7 @@ var init_stack_refresh = __esm({
311455
311484
  timeout;
311456
311485
  lastRefreshTime;
311457
311486
  queuedPromises = [];
311487
+ stopped = false;
311458
311488
  start() {
311459
311489
  this.timeout = setTimeout(() => this.refresh(), 3e5);
311460
311490
  }
@@ -311467,6 +311497,9 @@ var init_stack_refresh = __esm({
311467
311497
  qualifier: this.props.qualifier
311468
311498
  });
311469
311499
  this.justRefreshedStacks();
311500
+ if (this.stopped) {
311501
+ return;
311502
+ }
311470
311503
  this.timeout = setTimeout(() => this.refresh(), Math.max(startTime + 3e5 - Date.now(), 0));
311471
311504
  }
311472
311505
  justRefreshedStacks() {
@@ -311491,6 +311524,7 @@ var init_stack_refresh = __esm({
311491
311524
  ]);
311492
311525
  }
311493
311526
  stop() {
311527
+ this.stopped = true;
311494
311528
  clearTimeout(this.timeout);
311495
311529
  }
311496
311530
  };
@@ -316997,33 +317031,35 @@ var init_toolkit = __esm({
316997
317031
  deploymentMethod: options.deploymentMethod,
316998
317032
  cleanupOnNoOp: isExecutingChangeSetDeployment(options.deploymentMethod)
316999
317033
  }) : void 0;
317000
- const formatter = new DiffFormatter({
317001
- templateInfo: {
317002
- oldTemplate: currentTemplate,
317003
- newTemplate: stack,
317004
- changeSet: prepareResult?.changeSet
317005
- }
317006
- });
317007
- const securityDiff = formatter.formatSecurityDiff();
317008
- const stackDiff = formatter.formatStackDiff();
317009
- const hasSecurityChanges = securityDiff.permissionChangeType !== "none" /* NONE */;
317010
- const deployMotivation = hasSecurityChanges ? '"--require-approval" is enabled and stack includes security-sensitive updates.' : '"--require-approval" is enabled and stack includes updates.';
317011
- const diffOutput2 = hasSecurityChanges ? securityDiff.formattedDiff : stackDiff.formattedDiff;
317012
- const deployQuestion = `${diffOutput2}
317034
+ if (!prepareResult?.noOp) {
317035
+ const formatter = new DiffFormatter({
317036
+ templateInfo: {
317037
+ oldTemplate: currentTemplate,
317038
+ newTemplate: stack,
317039
+ changeSet: prepareResult?.changeSet
317040
+ }
317041
+ });
317042
+ const securityDiff = formatter.formatSecurityDiff();
317043
+ const stackDiff = formatter.formatStackDiff();
317044
+ const hasSecurityChanges = securityDiff.permissionChangeType !== "none" /* NONE */;
317045
+ const deployMotivation = hasSecurityChanges ? '"--require-approval" is enabled and stack includes security-sensitive updates.' : '"--require-approval" is enabled and stack includes updates.';
317046
+ const diffOutput2 = hasSecurityChanges ? securityDiff.formattedDiff : stackDiff.formattedDiff;
317047
+ const deployQuestion = `${diffOutput2}
317013
317048
 
317014
317049
  ${deployMotivation}
317015
317050
  Do you wish to deploy these changes`;
317016
- const deployConfirmed = await ioHelper.requestResponse(IO.CDK_TOOLKIT_I5060.req(deployQuestion, {
317017
- motivation: deployMotivation,
317018
- concurrency,
317019
- permissionChangeType: securityDiff.permissionChangeType,
317020
- templateDiffs: formatter.diffs
317021
- }));
317022
- if (!deployConfirmed) {
317023
- if (prepareResult?.changeSet?.ChangeSetName) {
317024
- await deployments.cleanupChangeSet(stack, prepareResult.changeSet.ChangeSetName);
317051
+ const deployConfirmed = await ioHelper.requestResponse(IO.CDK_TOOLKIT_I5060.req(deployQuestion, {
317052
+ motivation: deployMotivation,
317053
+ concurrency,
317054
+ permissionChangeType: securityDiff.permissionChangeType,
317055
+ templateDiffs: formatter.diffs
317056
+ }));
317057
+ if (!deployConfirmed) {
317058
+ if (prepareResult?.changeSet?.ChangeSetName) {
317059
+ await deployments.cleanupChangeSet(stack, prepareResult.changeSet.ChangeSetName);
317060
+ }
317061
+ throw new ToolkitError("DeployAborted", "Aborted by user");
317025
317062
  }
317026
- throw new ToolkitError("DeployAborted", "Aborted by user");
317027
317063
  }
317028
317064
  const stackIndex = stacks.indexOf(stack) + 1;
317029
317065
  const deploySpan = await ioHelper.span(SPAN.DEPLOY_STACK).begin(`${chalk25.bold(stack.displayName)}: deploying... [${stackIndex}/${stackCollection.stackCount}]`, {
@@ -324642,7 +324678,7 @@ var init_cdk_toolkit = __esm({
324642
324678
  deploymentMethod: options.deploymentMethod,
324643
324679
  cleanupOnNoOp: isExecutingChangeSetDeployment(options.deploymentMethod)
324644
324680
  }) : void 0;
324645
- if (requireApproval !== import_cloud_assembly_schema7.RequireApproval.NEVER) {
324681
+ if (requireApproval !== import_cloud_assembly_schema7.RequireApproval.NEVER && !prepareResult?.noOp) {
324646
324682
  const currentTemplate = await this.props.deployments.readCurrentTemplate(stack);
324647
324683
  const formatter = new DiffFormatter({
324648
324684
  templateInfo: {
@@ -324971,7 +325007,20 @@ var init_cdk_toolkit = __esm({
324971
325007
  deployments: this.props.deployments,
324972
325008
  ioHelper: asIoHelper(this.ioHost, "import")
324973
325009
  });
324974
- const { additions, hasNonAdditions } = await resourceImporter.discoverImportableResources(options.force);
325010
+ const { additions, hasNonAdditions, diffFormatter } = await resourceImporter.discoverImportableResources(options.force);
325011
+ if (hasNonAdditions && !options.force) {
325012
+ const ioHelper = this.ioHost.asIoHelper();
325013
+ await ioHelper.defaults.info(
325014
+ `The following resources have pending updates that will be reconciled with a ${chalk31.blueBright("cdk deploy")} after import:`
325015
+ );
325016
+ const { formattedDiff } = diffFormatter.formatStackDiff();
325017
+ await ioHelper.defaults.info(formattedDiff);
325018
+ const confirmed = await ioHelper.requestResponse(IO.CDK_TOOLKIT_I7010.req("Perform import?", { motivation: "Confirm import with pending drift" }));
325019
+ if (!confirmed) {
325020
+ await ioHelper.defaults.info("Import cancelled.");
325021
+ return;
325022
+ }
325023
+ }
324975
325024
  if (additions.length === 0) {
324976
325025
  await this.ioHost.asIoHelper().defaults.warn(
324977
325026
  "%s: no new resources compared to the currently deployed stack, skipping import.",
@@ -325003,20 +325052,37 @@ var init_cdk_toolkit = __esm({
325003
325052
  usePreviousParameters: true,
325004
325053
  rollback: options.rollback
325005
325054
  });
325006
- await this.ioHost.asIoHelper().defaults.info(
325007
- `Import operation complete. We recommend you run a ${chalk31.blueBright("drift detection")} operation to confirm your CDK app resource definitions are up-to-date. Read more here: ` + chalk31.underline.blueBright(
325008
- "https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/detect-drift-stack.html"
325009
- )
325010
- );
325011
325055
  if (actualImport.importResources.length < additions.length) {
325012
- await this.ioHost.asIoHelper().defaults.info("");
325013
325056
  await this.ioHost.asIoHelper().defaults.warn(
325014
325057
  `Some resources were skipped. Run another ${chalk31.blueBright("cdk import")} or a ${chalk31.blueBright("cdk deploy")} to bring the stack up-to-date with your CDK app definition.`
325015
325058
  );
325016
325059
  } else if (hasNonAdditions) {
325017
- await this.ioHost.asIoHelper().defaults.info("");
325018
- await this.ioHost.asIoHelper().defaults.warn(
325019
- `Your app has pending updates or deletes excluded from this import operation. Run a ${chalk31.blueBright("cdk deploy")} to bring the stack up-to-date with your CDK app definition.`
325060
+ if (options.force) {
325061
+ await this.ioHost.asIoHelper().defaults.info(
325062
+ `Import complete. Run ${chalk31.blueBright("cdk deploy")} to update the stack to match your CDK app.`
325063
+ );
325064
+ } else {
325065
+ const deployNow = await this.ioHost.asIoHelper().requestResponse(
325066
+ IO.CDK_TOOLKIT_I7010.req(`Finish with a ${chalk31.blueBright("cdk deploy")} now?`, { motivation: "Update stack to match CDK app after import" })
325067
+ );
325068
+ if (deployNow) {
325069
+ await this.deploy({
325070
+ selector: options.selector,
325071
+ toolkitStackName: options.toolkitStackName,
325072
+ roleArn: options.roleArn,
325073
+ deploymentMethod: options.deploymentMethod
325074
+ });
325075
+ } else {
325076
+ await this.ioHost.asIoHelper().defaults.info(
325077
+ `Import complete. Remember to run ${chalk31.blueBright("cdk deploy")} to update the stack to match your CDK app.`
325078
+ );
325079
+ }
325080
+ }
325081
+ } else {
325082
+ await this.ioHost.asIoHelper().defaults.info(
325083
+ `Import operation complete. We recommend you run a ${chalk31.blueBright("drift detection")} operation to confirm your CDK app resource definitions are up-to-date. Read more here: ` + chalk31.underline.blueBright(
325084
+ "https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/detect-drift-stack.html"
325085
+ )
325020
325086
  );
325021
325087
  }
325022
325088
  }
@@ -325108,7 +325174,9 @@ var init_cdk_toolkit = __esm({
325108
325174
  if (!quiet) {
325109
325175
  await printSerializedObject(this.ioHost.asIoHelper(), obscureTemplate(stacks.firstStack.template), json ?? false);
325110
325176
  }
325111
- await displayFlagsMessage(this.ioHost.asIoHelper(), this.toolkit, this.props.cloudExecutable);
325177
+ if (quiet || !this.ioHost.isCI) {
325178
+ await displayFlagsMessage(this.ioHost.asIoHelper(), this.toolkit, this.props.cloudExecutable);
325179
+ }
325112
325180
  return void 0;
325113
325181
  }
325114
325182
  await this.ioHost.asIoHelper().defaults.info(chalk31.green(`Successfully synthesized to ${chalk31.blue(path42.resolve(stacks.assembly.directory))}`));
package/package.json CHANGED
@@ -80,12 +80,12 @@
80
80
  "ts-mock-imports": "^1.3.19",
81
81
  "tsx": "^4.21.0",
82
82
  "typescript": "5.9",
83
- "@aws-cdk/cdk-assets-lib": "^1.4.4",
83
+ "@aws-cdk/cdk-assets-lib": "^1.4.5",
84
84
  "@aws-cdk/cloud-assembly-api": "2.2.2",
85
- "@aws-cdk/cloud-assembly-schema": ">=53.17.0",
85
+ "@aws-cdk/cloud-assembly-schema": ">=53.18.0",
86
86
  "@aws-cdk/cloudformation-diff": "2.187.1",
87
87
  "@aws-cdk/cx-api": "^2",
88
- "@aws-cdk/toolkit-lib": "^1.22.1",
88
+ "@aws-cdk/toolkit-lib": "^1.24.0",
89
89
  "@aws-sdk/client-appsync": "^3",
90
90
  "@aws-sdk/client-bedrock-agentcore-control": "^3",
91
91
  "@aws-sdk/client-cloudcontrol": "^3",
@@ -157,7 +157,7 @@
157
157
  "publishConfig": {
158
158
  "access": "public"
159
159
  },
160
- "version": "2.1118.3",
160
+ "version": "2.1119.0",
161
161
  "packageManager": "yarn@4.13.0",
162
162
  "types": "lib/index.d.ts",
163
163
  "exports": {