aws-cdk 2.1118.4 → 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/build-info.json +2 -2
- package/lib/cli/cdk-toolkit.js +50 -10
- package/lib/index.js +114 -51
- package/package.json +3 -3
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.
|
|
3604
|
+
module2.exports = { version: "2.1119.0" };
|
|
3605
3605
|
}
|
|
3606
3606
|
});
|
|
3607
3607
|
|
|
@@ -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");
|
|
@@ -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
|
-
|
|
142415
|
-
errors
|
|
142416
|
-
|
|
142417
|
-
|
|
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 =
|
|
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
|
-
|
|
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
|
/**
|
|
@@ -317002,33 +317031,35 @@ var init_toolkit = __esm({
|
|
|
317002
317031
|
deploymentMethod: options.deploymentMethod,
|
|
317003
317032
|
cleanupOnNoOp: isExecutingChangeSetDeployment(options.deploymentMethod)
|
|
317004
317033
|
}) : void 0;
|
|
317005
|
-
|
|
317006
|
-
|
|
317007
|
-
|
|
317008
|
-
|
|
317009
|
-
|
|
317010
|
-
|
|
317011
|
-
|
|
317012
|
-
|
|
317013
|
-
|
|
317014
|
-
|
|
317015
|
-
|
|
317016
|
-
|
|
317017
|
-
|
|
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}
|
|
317018
317048
|
|
|
317019
317049
|
${deployMotivation}
|
|
317020
317050
|
Do you wish to deploy these changes`;
|
|
317021
|
-
|
|
317022
|
-
|
|
317023
|
-
|
|
317024
|
-
|
|
317025
|
-
|
|
317026
|
-
|
|
317027
|
-
|
|
317028
|
-
|
|
317029
|
-
|
|
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");
|
|
317030
317062
|
}
|
|
317031
|
-
throw new ToolkitError("DeployAborted", "Aborted by user");
|
|
317032
317063
|
}
|
|
317033
317064
|
const stackIndex = stacks.indexOf(stack) + 1;
|
|
317034
317065
|
const deploySpan = await ioHelper.span(SPAN.DEPLOY_STACK).begin(`${chalk25.bold(stack.displayName)}: deploying... [${stackIndex}/${stackCollection.stackCount}]`, {
|
|
@@ -324647,7 +324678,7 @@ var init_cdk_toolkit = __esm({
|
|
|
324647
324678
|
deploymentMethod: options.deploymentMethod,
|
|
324648
324679
|
cleanupOnNoOp: isExecutingChangeSetDeployment(options.deploymentMethod)
|
|
324649
324680
|
}) : void 0;
|
|
324650
|
-
if (requireApproval !== import_cloud_assembly_schema7.RequireApproval.NEVER) {
|
|
324681
|
+
if (requireApproval !== import_cloud_assembly_schema7.RequireApproval.NEVER && !prepareResult?.noOp) {
|
|
324651
324682
|
const currentTemplate = await this.props.deployments.readCurrentTemplate(stack);
|
|
324652
324683
|
const formatter = new DiffFormatter({
|
|
324653
324684
|
templateInfo: {
|
|
@@ -324976,7 +325007,20 @@ var init_cdk_toolkit = __esm({
|
|
|
324976
325007
|
deployments: this.props.deployments,
|
|
324977
325008
|
ioHelper: asIoHelper(this.ioHost, "import")
|
|
324978
325009
|
});
|
|
324979
|
-
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
|
+
}
|
|
324980
325024
|
if (additions.length === 0) {
|
|
324981
325025
|
await this.ioHost.asIoHelper().defaults.warn(
|
|
324982
325026
|
"%s: no new resources compared to the currently deployed stack, skipping import.",
|
|
@@ -325008,20 +325052,37 @@ var init_cdk_toolkit = __esm({
|
|
|
325008
325052
|
usePreviousParameters: true,
|
|
325009
325053
|
rollback: options.rollback
|
|
325010
325054
|
});
|
|
325011
|
-
await this.ioHost.asIoHelper().defaults.info(
|
|
325012
|
-
`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(
|
|
325013
|
-
"https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/detect-drift-stack.html"
|
|
325014
|
-
)
|
|
325015
|
-
);
|
|
325016
325055
|
if (actualImport.importResources.length < additions.length) {
|
|
325017
|
-
await this.ioHost.asIoHelper().defaults.info("");
|
|
325018
325056
|
await this.ioHost.asIoHelper().defaults.warn(
|
|
325019
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.`
|
|
325020
325058
|
);
|
|
325021
325059
|
} else if (hasNonAdditions) {
|
|
325022
|
-
|
|
325023
|
-
|
|
325024
|
-
|
|
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
|
+
)
|
|
325025
325086
|
);
|
|
325026
325087
|
}
|
|
325027
325088
|
}
|
|
@@ -325113,7 +325174,9 @@ var init_cdk_toolkit = __esm({
|
|
|
325113
325174
|
if (!quiet) {
|
|
325114
325175
|
await printSerializedObject(this.ioHost.asIoHelper(), obscureTemplate(stacks.firstStack.template), json ?? false);
|
|
325115
325176
|
}
|
|
325116
|
-
|
|
325177
|
+
if (quiet || !this.ioHost.isCI) {
|
|
325178
|
+
await displayFlagsMessage(this.ioHost.asIoHelper(), this.toolkit, this.props.cloudExecutable);
|
|
325179
|
+
}
|
|
325117
325180
|
return void 0;
|
|
325118
325181
|
}
|
|
325119
325182
|
await this.ioHost.asIoHelper().defaults.info(chalk31.green(`Successfully synthesized to ${chalk31.blue(path42.resolve(stacks.assembly.directory))}`));
|
package/package.json
CHANGED
|
@@ -82,10 +82,10 @@
|
|
|
82
82
|
"typescript": "5.9",
|
|
83
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.
|
|
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.
|
|
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.
|
|
160
|
+
"version": "2.1119.0",
|
|
161
161
|
"packageManager": "yarn@4.13.0",
|
|
162
162
|
"types": "lib/index.d.ts",
|
|
163
163
|
"exports": {
|