@aws-cdk/integ-runner 2.197.17 → 2.197.18
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/workers/extract/index.js +389 -359
- package/package.json +5 -5
|
@@ -4672,7 +4672,7 @@ var require_semver2 = __commonJS({
|
|
|
4672
4672
|
// ../cloud-assembly-schema/cli-version.json
|
|
4673
4673
|
var require_cli_version = __commonJS({
|
|
4674
4674
|
"../cloud-assembly-schema/cli-version.json"(exports2, module2) {
|
|
4675
|
-
module2.exports = { version: "2.
|
|
4675
|
+
module2.exports = { version: "2.1119.0" };
|
|
4676
4676
|
}
|
|
4677
4677
|
});
|
|
4678
4678
|
|
|
@@ -293628,6 +293628,26 @@ async function waitForChangeSet(cfn, ioHelper, stackName, changeSetName, { fetch
|
|
|
293628
293628
|
}
|
|
293629
293629
|
return ret;
|
|
293630
293630
|
}
|
|
293631
|
+
async function waitForChangeSetGone(cfn, ioHelper, stackName, changeSetName) {
|
|
293632
|
+
await ioHelper.defaults.debug((0, import_util26.format)("Waiting for changeset %s on stack %s to finish deleting...", changeSetName, stackName));
|
|
293633
|
+
await waitFor(async () => {
|
|
293634
|
+
try {
|
|
293635
|
+
const description = await cfn.describeChangeSet({
|
|
293636
|
+
StackName: stackName,
|
|
293637
|
+
ChangeSetName: changeSetName
|
|
293638
|
+
});
|
|
293639
|
+
if (description.Status === import_client_cloudformation3.ChangeSetStatus.DELETE_COMPLETE || description.Status === import_client_cloudformation3.ChangeSetStatus.DELETE_FAILED) {
|
|
293640
|
+
return true;
|
|
293641
|
+
}
|
|
293642
|
+
return void 0;
|
|
293643
|
+
} catch (e6) {
|
|
293644
|
+
if (e6.name === "ChangeSetNotFoundException") {
|
|
293645
|
+
return true;
|
|
293646
|
+
}
|
|
293647
|
+
throw e6;
|
|
293648
|
+
}
|
|
293649
|
+
});
|
|
293650
|
+
}
|
|
293631
293651
|
async function createDiffChangeSet(ioHelper, options) {
|
|
293632
293652
|
return uploadBodyParameterAndCreateChangeSet(ioHelper, {
|
|
293633
293653
|
...options,
|
|
@@ -293824,6 +293844,7 @@ var init_cfn_api = __esm({
|
|
|
293824
293844
|
__name(describeChangeSet, "describeChangeSet");
|
|
293825
293845
|
__name(waitFor, "waitFor");
|
|
293826
293846
|
__name(waitForChangeSet, "waitForChangeSet");
|
|
293847
|
+
__name(waitForChangeSetGone, "waitForChangeSetGone");
|
|
293827
293848
|
__name(createDiffChangeSet, "createDiffChangeSet");
|
|
293828
293849
|
__name(templatesFromAssetManifestArtifact, "templatesFromAssetManifestArtifact");
|
|
293829
293850
|
__name(uploadBodyParameterAndCreateChangeSet, "uploadBodyParameterAndCreateChangeSet");
|
|
@@ -312007,16 +312028,19 @@ var init_early_validation = __esm({
|
|
|
312007
312028
|
"../toolkit-lib/lib/api/deployments/early-validation.ts"() {
|
|
312008
312029
|
"use strict";
|
|
312009
312030
|
EarlyValidationReporter = class {
|
|
312010
|
-
constructor(sdk, envResources) {
|
|
312031
|
+
constructor(sdk, envResources, ioHelper) {
|
|
312011
312032
|
this.sdk = sdk;
|
|
312012
312033
|
this.envResources = envResources;
|
|
312034
|
+
this.ioHelper = ioHelper;
|
|
312013
312035
|
}
|
|
312014
312036
|
sdk;
|
|
312015
312037
|
envResources;
|
|
312038
|
+
ioHelper;
|
|
312016
312039
|
static {
|
|
312017
312040
|
__name(this, "EarlyValidationReporter");
|
|
312018
312041
|
}
|
|
312019
312042
|
async fetchDetails(changeSetName, stackName) {
|
|
312043
|
+
const summary = `Early validation failed for stack '${stackName}' (ChangeSet '${changeSetName}')`;
|
|
312020
312044
|
let operationEvents = [];
|
|
312021
312045
|
try {
|
|
312022
312046
|
operationEvents = await this.getFailedEvents(stackName, changeSetName);
|
|
@@ -312026,12 +312050,12 @@ var init_early_validation = __esm({
|
|
|
312026
312050
|
currentVersion = (await this.envResources.lookupToolkit()).version;
|
|
312027
312051
|
} catch (e6) {
|
|
312028
312052
|
}
|
|
312029
|
-
|
|
312030
|
-
errors
|
|
312031
|
-
|
|
312032
|
-
|
|
312053
|
+
await this.ioHelper.defaults.warn(
|
|
312054
|
+
`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"}.`
|
|
312055
|
+
);
|
|
312056
|
+
return summary;
|
|
312033
312057
|
}
|
|
312034
|
-
let message2 =
|
|
312058
|
+
let message2 = summary;
|
|
312035
312059
|
if (operationEvents.length > 0) {
|
|
312036
312060
|
const failures = operationEvents.map((event) => ` - ${event.ValidationStatusReason} (at ${event.ValidationPath})`).join("\n");
|
|
312037
312061
|
message2 += `:
|
|
@@ -312452,7 +312476,7 @@ var init_deploy_stack = __esm({
|
|
|
312452
312476
|
await this.ioHelper.defaults.debug((0, import_util51.format)("Initiated creation of changeset: %s; waiting for it to finish creating...", changeSet.Id));
|
|
312453
312477
|
const environmentResourcesRegistry = new EnvironmentResourcesRegistry();
|
|
312454
312478
|
const envResources = environmentResourcesRegistry.for(this.options.resolvedEnvironment, this.options.sdk, this.ioHelper);
|
|
312455
|
-
const validationReporter = new EarlyValidationReporter(this.options.sdk, envResources);
|
|
312479
|
+
const validationReporter = new EarlyValidationReporter(this.options.sdk, envResources, this.ioHelper);
|
|
312456
312480
|
try {
|
|
312457
312481
|
return await waitForChangeSet(this.cfn, this.ioHelper, this.stackName, changeSetName, {
|
|
312458
312482
|
fetchAll: willExecute,
|
|
@@ -312519,6 +312543,7 @@ var init_deploy_stack = __esm({
|
|
|
312519
312543
|
StackName: this.stackName,
|
|
312520
312544
|
ChangeSetName: changeSetName
|
|
312521
312545
|
});
|
|
312546
|
+
await waitForChangeSetGone(this.cfn, this.ioHelper, this.stackName, changeSetName);
|
|
312522
312547
|
}
|
|
312523
312548
|
}
|
|
312524
312549
|
async updateTerminationProtection() {
|
|
@@ -313064,6 +313089,304 @@ var init_deployments2 = __esm({
|
|
|
313064
313089
|
}
|
|
313065
313090
|
});
|
|
313066
313091
|
|
|
313092
|
+
// ../toolkit-lib/lib/api/streams.ts
|
|
313093
|
+
var import_node_stream2, StringWriteStream;
|
|
313094
|
+
var init_streams = __esm({
|
|
313095
|
+
"../toolkit-lib/lib/api/streams.ts"() {
|
|
313096
|
+
"use strict";
|
|
313097
|
+
import_node_stream2 = require("node:stream");
|
|
313098
|
+
StringWriteStream = class extends import_node_stream2.Writable {
|
|
313099
|
+
static {
|
|
313100
|
+
__name(this, "StringWriteStream");
|
|
313101
|
+
}
|
|
313102
|
+
buffer = [];
|
|
313103
|
+
/**
|
|
313104
|
+
* Terminal width in columns.
|
|
313105
|
+
* Used by formatTable() to apply width constraints and prevent table overflow.
|
|
313106
|
+
*/
|
|
313107
|
+
get columns() {
|
|
313108
|
+
return process.stdout.columns;
|
|
313109
|
+
}
|
|
313110
|
+
constructor() {
|
|
313111
|
+
super();
|
|
313112
|
+
}
|
|
313113
|
+
_write(chunk, _encoding, callback) {
|
|
313114
|
+
this.buffer.push(chunk.toString());
|
|
313115
|
+
callback();
|
|
313116
|
+
}
|
|
313117
|
+
toString() {
|
|
313118
|
+
return this.buffer.join("");
|
|
313119
|
+
}
|
|
313120
|
+
};
|
|
313121
|
+
}
|
|
313122
|
+
});
|
|
313123
|
+
|
|
313124
|
+
// ../toolkit-lib/lib/api/diff/diff-formatter.ts
|
|
313125
|
+
function permissionTypeFromDiff(diff) {
|
|
313126
|
+
if (diff.permissionsBroadened) {
|
|
313127
|
+
return "broadening" /* BROADENING */;
|
|
313128
|
+
} else if (diff.permissionsAnyChanges) {
|
|
313129
|
+
return "non-broadening" /* NON_BROADENING */;
|
|
313130
|
+
}
|
|
313131
|
+
return "none" /* NONE */;
|
|
313132
|
+
}
|
|
313133
|
+
function buildLogicalToPathMap(stack) {
|
|
313134
|
+
const map2 = {};
|
|
313135
|
+
for (const md of stack.findMetadataByType(cxschema9.ArtifactMetadataEntryType.LOGICAL_ID)) {
|
|
313136
|
+
map2[md.data] = md.path;
|
|
313137
|
+
}
|
|
313138
|
+
return map2;
|
|
313139
|
+
}
|
|
313140
|
+
function logicalIdMapFromTemplate(template) {
|
|
313141
|
+
const ret = {};
|
|
313142
|
+
for (const [logicalId, resource] of Object.entries(template.Resources ?? {})) {
|
|
313143
|
+
const path38 = resource?.Metadata?.["aws:cdk:path"];
|
|
313144
|
+
if (path38) {
|
|
313145
|
+
ret[logicalId] = path38;
|
|
313146
|
+
}
|
|
313147
|
+
}
|
|
313148
|
+
return ret;
|
|
313149
|
+
}
|
|
313150
|
+
function obscureDiff(diff) {
|
|
313151
|
+
if (diff.unknown) {
|
|
313152
|
+
diff.unknown = diff.unknown.filter((change) => {
|
|
313153
|
+
if (!change) {
|
|
313154
|
+
return true;
|
|
313155
|
+
}
|
|
313156
|
+
if (change.newValue?.CheckBootstrapVersion) {
|
|
313157
|
+
return false;
|
|
313158
|
+
}
|
|
313159
|
+
if (change.oldValue?.CheckBootstrapVersion) {
|
|
313160
|
+
return false;
|
|
313161
|
+
}
|
|
313162
|
+
return true;
|
|
313163
|
+
});
|
|
313164
|
+
}
|
|
313165
|
+
if (diff.resources) {
|
|
313166
|
+
diff.resources = diff.resources.filter((change) => {
|
|
313167
|
+
if (!change) {
|
|
313168
|
+
return true;
|
|
313169
|
+
}
|
|
313170
|
+
if (change.newResourceType === "AWS::CDK::Metadata") {
|
|
313171
|
+
return false;
|
|
313172
|
+
}
|
|
313173
|
+
if (change.oldResourceType === "AWS::CDK::Metadata") {
|
|
313174
|
+
return false;
|
|
313175
|
+
}
|
|
313176
|
+
return true;
|
|
313177
|
+
});
|
|
313178
|
+
}
|
|
313179
|
+
}
|
|
313180
|
+
var import_node_util3, cxschema9, import_cloudformation_diff, chalk17, DiffFormatter;
|
|
313181
|
+
var init_diff_formatter = __esm({
|
|
313182
|
+
"../toolkit-lib/lib/api/diff/diff-formatter.ts"() {
|
|
313183
|
+
"use strict";
|
|
313184
|
+
import_node_util3 = require("node:util");
|
|
313185
|
+
cxschema9 = __toESM(require_lib2());
|
|
313186
|
+
import_cloudformation_diff = __toESM(require_lib11());
|
|
313187
|
+
chalk17 = __toESM(require_source());
|
|
313188
|
+
init_payloads();
|
|
313189
|
+
init_streams();
|
|
313190
|
+
DiffFormatter = class {
|
|
313191
|
+
static {
|
|
313192
|
+
__name(this, "DiffFormatter");
|
|
313193
|
+
}
|
|
313194
|
+
templateInfo;
|
|
313195
|
+
stackName;
|
|
313196
|
+
isImport;
|
|
313197
|
+
mappings;
|
|
313198
|
+
/**
|
|
313199
|
+
* Cache of computed TemplateDiffs, indexed by stack name.
|
|
313200
|
+
*/
|
|
313201
|
+
cache = /* @__PURE__ */ new Map();
|
|
313202
|
+
constructor(props) {
|
|
313203
|
+
this.templateInfo = props.templateInfo;
|
|
313204
|
+
this.stackName = props.templateInfo.newTemplate.displayName ?? props.templateInfo.newTemplate.stackName;
|
|
313205
|
+
this.isImport = props.templateInfo.isImport ?? false;
|
|
313206
|
+
this.mappings = props.templateInfo.mappings ?? {};
|
|
313207
|
+
}
|
|
313208
|
+
get diffs() {
|
|
313209
|
+
return Object.fromEntries(this.cache);
|
|
313210
|
+
}
|
|
313211
|
+
/**
|
|
313212
|
+
* Compute the diff for a single stack. Results are cached by stack name.
|
|
313213
|
+
*
|
|
313214
|
+
* @param stackName - The name to cache the diff under
|
|
313215
|
+
* @param oldTemplate - The deployed template
|
|
313216
|
+
* @param newTemplate - The new/generated template (read from the artifact)
|
|
313217
|
+
* @param changeSet - The CloudFormation changeset for this specific stack, if available
|
|
313218
|
+
* @param mappings - Resource move mappings
|
|
313219
|
+
*/
|
|
313220
|
+
computeDiff(stackName, oldTemplate, newTemplate, changeSet, mappings) {
|
|
313221
|
+
if (!this.cache.has(stackName)) {
|
|
313222
|
+
const templateDiff = (0, import_cloudformation_diff.fullDiff)(oldTemplate, newTemplate, changeSet, this.isImport);
|
|
313223
|
+
const setMove = /* @__PURE__ */ __name((change, direction, location) => {
|
|
313224
|
+
if (location != null) {
|
|
313225
|
+
const [sourceStackName, sourceLogicalId] = location.split(".");
|
|
313226
|
+
change.move = {
|
|
313227
|
+
direction,
|
|
313228
|
+
stackName: sourceStackName,
|
|
313229
|
+
resourceLogicalId: sourceLogicalId
|
|
313230
|
+
};
|
|
313231
|
+
}
|
|
313232
|
+
}, "setMove");
|
|
313233
|
+
templateDiff.resources.forEachDifference((id, change) => {
|
|
313234
|
+
const location = `${stackName}.${id}`;
|
|
313235
|
+
if (change.isAddition && Object.values(mappings).includes(location)) {
|
|
313236
|
+
setMove(change, "from", Object.keys(mappings).find((k6) => mappings[k6] === location));
|
|
313237
|
+
} else if (change.isRemoval && Object.keys(mappings).includes(location)) {
|
|
313238
|
+
setMove(change, "to", mappings[location]);
|
|
313239
|
+
}
|
|
313240
|
+
});
|
|
313241
|
+
this.cache.set(stackName, templateDiff);
|
|
313242
|
+
}
|
|
313243
|
+
return this.cache.get(stackName);
|
|
313244
|
+
}
|
|
313245
|
+
/**
|
|
313246
|
+
* Format the stack diff, including all nested stacks.
|
|
313247
|
+
*/
|
|
313248
|
+
formatStackDiff(options = {}) {
|
|
313249
|
+
return this.formatStackDiffHelper({
|
|
313250
|
+
oldTemplate: this.templateInfo.oldTemplate,
|
|
313251
|
+
newTemplate: this.templateInfo.newTemplate.template,
|
|
313252
|
+
stackName: this.stackName,
|
|
313253
|
+
nestedStacks: this.templateInfo.nestedStacks,
|
|
313254
|
+
changeSet: this.templateInfo.changeSet,
|
|
313255
|
+
mappings: this.mappings,
|
|
313256
|
+
logicalIdMap: buildLogicalToPathMap(this.templateInfo.newTemplate)
|
|
313257
|
+
}, options);
|
|
313258
|
+
}
|
|
313259
|
+
formatStackDiffHelper(params, options = {}) {
|
|
313260
|
+
const { oldTemplate, newTemplate, stackName, nestedStacks, changeSet, mappings, logicalIdMap } = params;
|
|
313261
|
+
const diff = this.computeDiff(stackName, oldTemplate, newTemplate, changeSet, mappings);
|
|
313262
|
+
const stream = new StringWriteStream();
|
|
313263
|
+
let numStacksWithChanges = 0;
|
|
313264
|
+
let formattedDiff = "";
|
|
313265
|
+
let filteredChangesCount = 0;
|
|
313266
|
+
try {
|
|
313267
|
+
if (stackName && (!options.quiet || !diff.isEmpty)) {
|
|
313268
|
+
stream.write((0, import_node_util3.format)(`Stack ${chalk17.bold(stackName)}
|
|
313269
|
+
`));
|
|
313270
|
+
}
|
|
313271
|
+
if (!options.quiet && this.isImport) {
|
|
313272
|
+
stream.write("Parameters and rules created during migration do not affect resource configuration.\n");
|
|
313273
|
+
}
|
|
313274
|
+
let activeDiff = diff;
|
|
313275
|
+
if (diff.differenceCount && !options.strict) {
|
|
313276
|
+
const mangledNewTemplate = JSON.parse((0, import_cloudformation_diff.mangleLikeCloudFormation)(JSON.stringify(newTemplate)));
|
|
313277
|
+
const mangledDiff = (0, import_cloudformation_diff.fullDiff)(oldTemplate, mangledNewTemplate, changeSet);
|
|
313278
|
+
filteredChangesCount = Math.max(0, diff.differenceCount - mangledDiff.differenceCount);
|
|
313279
|
+
if (filteredChangesCount > 0) {
|
|
313280
|
+
activeDiff = mangledDiff;
|
|
313281
|
+
}
|
|
313282
|
+
}
|
|
313283
|
+
if (!options.strict) {
|
|
313284
|
+
obscureDiff(activeDiff);
|
|
313285
|
+
}
|
|
313286
|
+
if (!activeDiff.isEmpty) {
|
|
313287
|
+
numStacksWithChanges++;
|
|
313288
|
+
(0, import_cloudformation_diff.formatDifferences)(stream, activeDiff, {
|
|
313289
|
+
...logicalIdMapFromTemplate(oldTemplate),
|
|
313290
|
+
...logicalIdMapFromTemplate(newTemplate),
|
|
313291
|
+
...logicalIdMap
|
|
313292
|
+
}, options.contextLines);
|
|
313293
|
+
} else if (!options.quiet) {
|
|
313294
|
+
stream.write(chalk17.green("There were no differences\n"));
|
|
313295
|
+
}
|
|
313296
|
+
if (filteredChangesCount > 0) {
|
|
313297
|
+
stream.write(chalk17.yellow(`Omitted ${filteredChangesCount} changes because they are likely mangled non-ASCII characters. Use --strict to print them.
|
|
313298
|
+
`));
|
|
313299
|
+
}
|
|
313300
|
+
} finally {
|
|
313301
|
+
formattedDiff = stream.toString();
|
|
313302
|
+
stream.end();
|
|
313303
|
+
}
|
|
313304
|
+
for (const [logicalId, nestedStack] of Object.entries(nestedStacks ?? {})) {
|
|
313305
|
+
const nextDiff = this.formatStackDiffHelper({
|
|
313306
|
+
oldTemplate: nestedStack.deployedTemplate,
|
|
313307
|
+
newTemplate: nestedStack.generatedTemplate,
|
|
313308
|
+
stackName: nestedStack.physicalName ?? logicalId,
|
|
313309
|
+
nestedStacks: nestedStack.nestedStackTemplates,
|
|
313310
|
+
changeSet: nestedStack.changeSet,
|
|
313311
|
+
mappings,
|
|
313312
|
+
logicalIdMap: {}
|
|
313313
|
+
}, options);
|
|
313314
|
+
numStacksWithChanges += nextDiff.numStacksWithChanges;
|
|
313315
|
+
formattedDiff += nextDiff.formattedDiff;
|
|
313316
|
+
}
|
|
313317
|
+
return { numStacksWithChanges, formattedDiff };
|
|
313318
|
+
}
|
|
313319
|
+
/**
|
|
313320
|
+
* Format the security diff, including all nested stacks.
|
|
313321
|
+
*/
|
|
313322
|
+
formatSecurityDiff(options = {}) {
|
|
313323
|
+
const { formattedDiff, permissionChangeType, numStacksWithChanges } = this.formatSecurityDiffHelper({
|
|
313324
|
+
oldTemplate: this.templateInfo.oldTemplate,
|
|
313325
|
+
newTemplate: this.templateInfo.newTemplate.template,
|
|
313326
|
+
stackName: this.stackName,
|
|
313327
|
+
nestedStacks: this.templateInfo.nestedStacks,
|
|
313328
|
+
changeSet: this.templateInfo.changeSet,
|
|
313329
|
+
logicalIdMap: buildLogicalToPathMap(this.templateInfo.newTemplate)
|
|
313330
|
+
}, options);
|
|
313331
|
+
return { formattedDiff, permissionChangeType, numStacksWithChanges };
|
|
313332
|
+
}
|
|
313333
|
+
formatSecurityDiffHelper(params, options = {}) {
|
|
313334
|
+
const { oldTemplate, newTemplate, stackName, nestedStacks, changeSet, logicalIdMap } = params;
|
|
313335
|
+
const diff = this.computeDiff(stackName, oldTemplate, newTemplate, changeSet, this.mappings);
|
|
313336
|
+
const permissionChangeType = permissionTypeFromDiff(diff);
|
|
313337
|
+
const stream = new StringWriteStream();
|
|
313338
|
+
if (!options.quiet || permissionChangeType !== "none" /* NONE */) {
|
|
313339
|
+
stream.write((0, import_node_util3.format)(`Stack ${chalk17.bold(stackName)}
|
|
313340
|
+
`));
|
|
313341
|
+
}
|
|
313342
|
+
try {
|
|
313343
|
+
(0, import_cloudformation_diff.formatSecurityChanges)(stream, diff, {
|
|
313344
|
+
...logicalIdMapFromTemplate(newTemplate),
|
|
313345
|
+
...logicalIdMap
|
|
313346
|
+
});
|
|
313347
|
+
} finally {
|
|
313348
|
+
stream.end();
|
|
313349
|
+
}
|
|
313350
|
+
let formattedDiff = stream.toString();
|
|
313351
|
+
if (!options.quiet && permissionChangeType === "none" /* NONE */) {
|
|
313352
|
+
formattedDiff += chalk17.green("There were no security-related changes (limitations: https://github.com/aws/aws-cdk/issues/1299)\n");
|
|
313353
|
+
}
|
|
313354
|
+
let numStacksWithChanges = permissionChangeType !== "none" /* NONE */ ? 1 : 0;
|
|
313355
|
+
let escalatedPermissionType = permissionChangeType;
|
|
313356
|
+
for (const [logicalId, nestedStack] of Object.entries(nestedStacks ?? {})) {
|
|
313357
|
+
const nestedResult = this.formatSecurityDiffHelper({
|
|
313358
|
+
oldTemplate: nestedStack.deployedTemplate,
|
|
313359
|
+
newTemplate: nestedStack.generatedTemplate,
|
|
313360
|
+
stackName: nestedStack.physicalName ?? logicalId,
|
|
313361
|
+
nestedStacks: nestedStack.nestedStackTemplates,
|
|
313362
|
+
changeSet: nestedStack.changeSet
|
|
313363
|
+
}, options);
|
|
313364
|
+
formattedDiff += nestedResult.formattedDiff ? "\n" + nestedResult.formattedDiff : "";
|
|
313365
|
+
numStacksWithChanges += nestedResult.numStacksWithChanges;
|
|
313366
|
+
if (nestedResult.permissionChangeType === "broadening" /* BROADENING */) {
|
|
313367
|
+
escalatedPermissionType = "broadening" /* BROADENING */;
|
|
313368
|
+
} else if (nestedResult.permissionChangeType === "non-broadening" /* NON_BROADENING */ && escalatedPermissionType === "none" /* NONE */) {
|
|
313369
|
+
escalatedPermissionType = "non-broadening" /* NON_BROADENING */;
|
|
313370
|
+
}
|
|
313371
|
+
}
|
|
313372
|
+
return { formattedDiff, permissionChangeType: escalatedPermissionType, numStacksWithChanges };
|
|
313373
|
+
}
|
|
313374
|
+
};
|
|
313375
|
+
__name(permissionTypeFromDiff, "permissionTypeFromDiff");
|
|
313376
|
+
__name(buildLogicalToPathMap, "buildLogicalToPathMap");
|
|
313377
|
+
__name(logicalIdMapFromTemplate, "logicalIdMapFromTemplate");
|
|
313378
|
+
__name(obscureDiff, "obscureDiff");
|
|
313379
|
+
}
|
|
313380
|
+
});
|
|
313381
|
+
|
|
313382
|
+
// ../toolkit-lib/lib/api/diff/index.ts
|
|
313383
|
+
var init_diff4 = __esm({
|
|
313384
|
+
"../toolkit-lib/lib/api/diff/index.ts"() {
|
|
313385
|
+
"use strict";
|
|
313386
|
+
init_diff_formatter();
|
|
313387
|
+
}
|
|
313388
|
+
});
|
|
313389
|
+
|
|
313067
313390
|
// ../toolkit-lib/lib/api/resource-import/importer.ts
|
|
313068
313391
|
function fmtdict(xs) {
|
|
313069
313392
|
return Object.entries(xs).map(([k6, v7]) => `${k6}=${v7}`).join(", ");
|
|
@@ -313083,16 +313406,16 @@ function removeNonImportResources(stack) {
|
|
|
313083
313406
|
delete template.Outputs;
|
|
313084
313407
|
return template;
|
|
313085
313408
|
}
|
|
313086
|
-
var import_util54, cfnDiff,
|
|
313409
|
+
var import_util54, cfnDiff, chalk18, fs30, ResourceImporter;
|
|
313087
313410
|
var init_importer = __esm({
|
|
313088
313411
|
"../toolkit-lib/lib/api/resource-import/importer.ts"() {
|
|
313089
313412
|
"use strict";
|
|
313090
313413
|
import_util54 = require("util");
|
|
313091
313414
|
cfnDiff = __toESM(require_lib11());
|
|
313092
|
-
|
|
313415
|
+
chalk18 = __toESM(require_source());
|
|
313093
313416
|
fs30 = __toESM(require_lib4());
|
|
313094
|
-
init_toolkit_error();
|
|
313095
313417
|
init_deployments2();
|
|
313418
|
+
init_diff4();
|
|
313096
313419
|
init_private();
|
|
313097
313420
|
ResourceImporter = class {
|
|
313098
313421
|
static {
|
|
@@ -313133,12 +313456,12 @@ var init_importer = __esm({
|
|
|
313133
313456
|
const descr = this.describeResource(resource.logicalId);
|
|
313134
313457
|
const idProps = contents[resource.logicalId];
|
|
313135
313458
|
if (idProps) {
|
|
313136
|
-
await this.ioHelper.defaults.info((0, import_util54.format)("%s: importing using %s",
|
|
313459
|
+
await this.ioHelper.defaults.info((0, import_util54.format)("%s: importing using %s", chalk18.blue(descr), chalk18.blue(fmtdict(idProps))));
|
|
313137
313460
|
ret.importResources.push(resource);
|
|
313138
313461
|
ret.resourceMap[resource.logicalId] = idProps;
|
|
313139
313462
|
delete contents[resource.logicalId];
|
|
313140
313463
|
} else {
|
|
313141
|
-
await this.ioHelper.defaults.info((0, import_util54.format)("%s: skipping",
|
|
313464
|
+
await this.ioHelper.defaults.info((0, import_util54.format)("%s: skipping", chalk18.blue(descr)));
|
|
313142
313465
|
}
|
|
313143
313466
|
}
|
|
313144
313467
|
const unknown = Object.keys(contents);
|
|
@@ -313182,9 +313505,9 @@ var init_importer = __esm({
|
|
|
313182
313505
|
});
|
|
313183
313506
|
assertIsSuccessfulDeployStackResult(result2);
|
|
313184
313507
|
const message2 = result2.noOp ? " \u2705 %s (no changes)" : " \u2705 %s";
|
|
313185
|
-
await this.ioHelper.defaults.info("\n" +
|
|
313508
|
+
await this.ioHelper.defaults.info("\n" + chalk18.green((0, import_util54.format)(message2, this.stack.displayName)));
|
|
313186
313509
|
} catch (e6) {
|
|
313187
|
-
await this.ioHelper.notify(IO.CDK_TOOLKIT_E3900.msg((0, import_util54.format)("\n \u274C %s failed: %s",
|
|
313510
|
+
await this.ioHelper.notify(IO.CDK_TOOLKIT_E3900.msg((0, import_util54.format)("\n \u274C %s failed: %s", chalk18.bold(this.stack.displayName), e6), { error: e6 }));
|
|
313188
313511
|
throw e6;
|
|
313189
313512
|
}
|
|
313190
313513
|
}
|
|
@@ -313200,13 +313523,9 @@ var init_importer = __esm({
|
|
|
313200
313523
|
const resourceChanges = Object.entries(diff.resources.changes).filter(([logicalId, _2]) => logicalId !== "CDKMetadata");
|
|
313201
313524
|
const nonAdditions = resourceChanges.filter(([_2, dif]) => !dif.isAddition);
|
|
313202
313525
|
const additions = resourceChanges.filter(([_2, dif]) => dif.isAddition);
|
|
313203
|
-
if (nonAdditions.length) {
|
|
313526
|
+
if (nonAdditions.length && allowNonAdditions) {
|
|
313204
313527
|
const offendingResources = nonAdditions.map(([logId, _2]) => this.describeResource(logId));
|
|
313205
|
-
|
|
313206
|
-
await this.ioHelper.defaults.warn(`Ignoring updated/deleted resources (--force): ${offendingResources.join(", ")}`);
|
|
313207
|
-
} else {
|
|
313208
|
-
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)`);
|
|
313209
|
-
}
|
|
313528
|
+
await this.ioHelper.defaults.warn(`Ignoring updated/deleted resources (--force): ${offendingResources.join(", ")}`);
|
|
313210
313529
|
}
|
|
313211
313530
|
return {
|
|
313212
313531
|
additions: additions.map(([logicalId, resourceDiff]) => ({
|
|
@@ -313214,7 +313533,14 @@ var init_importer = __esm({
|
|
|
313214
313533
|
resourceDiff,
|
|
313215
313534
|
resourceDefinition: addDefaultDeletionPolicy(this.stack.template?.Resources?.[logicalId] ?? {})
|
|
313216
313535
|
})),
|
|
313217
|
-
hasNonAdditions: nonAdditions.length > 0
|
|
313536
|
+
hasNonAdditions: nonAdditions.length > 0,
|
|
313537
|
+
nonAdditionNames: nonAdditions.map(([logId, _2]) => this.describeResource(logId)),
|
|
313538
|
+
diffFormatter: new DiffFormatter({
|
|
313539
|
+
templateInfo: {
|
|
313540
|
+
oldTemplate: currentTemplate,
|
|
313541
|
+
newTemplate: this.stack
|
|
313542
|
+
}
|
|
313543
|
+
})
|
|
313218
313544
|
};
|
|
313219
313545
|
}
|
|
313220
313546
|
/**
|
|
@@ -313285,7 +313611,7 @@ var init_importer = __esm({
|
|
|
313285
313611
|
for (const satisfiedPropSet of satisfiedPropSets) {
|
|
313286
313612
|
const candidateProps = Object.fromEntries(satisfiedPropSet.map((p6) => [p6, resourceProps[p6]]));
|
|
313287
313613
|
const displayCandidateProps = fmtdict(candidateProps);
|
|
313288
|
-
const importTheResource = await this.ioHelper.requestResponse(IO.CDK_TOOLKIT_I3100.req(`${
|
|
313614
|
+
const importTheResource = await this.ioHelper.requestResponse(IO.CDK_TOOLKIT_I3100.req(`${chalk18.blue(resourceName)} (${resourceType}): import with ${chalk18.yellow(displayCandidateProps)}`, {
|
|
313289
313615
|
resource: {
|
|
313290
313616
|
type: resourceType,
|
|
313291
313617
|
props: candidateProps,
|
|
@@ -313297,13 +313623,13 @@ var init_importer = __esm({
|
|
|
313297
313623
|
}
|
|
313298
313624
|
}
|
|
313299
313625
|
if (satisfiedPropSets.length > 0) {
|
|
313300
|
-
await this.ioHelper.defaults.info(
|
|
313626
|
+
await this.ioHelper.defaults.info(chalk18.grey(`Skipping import of ${resourceName}`));
|
|
313301
313627
|
return void 0;
|
|
313302
313628
|
}
|
|
313303
|
-
const prefix = `${
|
|
313629
|
+
const prefix = `${chalk18.blue(resourceName)} (${resourceType})`;
|
|
313304
313630
|
const promptPattern = `${prefix}: enter %s`;
|
|
313305
313631
|
if (idPropSets.length > 1) {
|
|
313306
|
-
const preamble = `${prefix}: enter one of ${idPropSets.map((x6) =>
|
|
313632
|
+
const preamble = `${prefix}: enter one of ${idPropSets.map((x6) => chalk18.blue(x6.join("+"))).join(", ")} to import (leave all empty to skip)`;
|
|
313307
313633
|
await this.ioHelper.defaults.info(preamble);
|
|
313308
313634
|
}
|
|
313309
313635
|
for (const idProps of idPropSets) {
|
|
@@ -313311,7 +313637,7 @@ var init_importer = __esm({
|
|
|
313311
313637
|
for (const idProp of idProps) {
|
|
313312
313638
|
const defaultValue = resourceProps[idProp] ?? "";
|
|
313313
313639
|
const response = await this.ioHelper.requestResponse(IO.CDK_TOOLKIT_I3110.req(
|
|
313314
|
-
(0, import_util54.format)(promptPattern,
|
|
313640
|
+
(0, import_util54.format)(promptPattern, chalk18.blue(idProp)),
|
|
313315
313641
|
{
|
|
313316
313642
|
resource: {
|
|
313317
313643
|
name: resourceName,
|
|
@@ -313332,7 +313658,7 @@ var init_importer = __esm({
|
|
|
313332
313658
|
return input;
|
|
313333
313659
|
}
|
|
313334
313660
|
}
|
|
313335
|
-
await this.ioHelper.defaults.info(
|
|
313661
|
+
await this.ioHelper.defaults.info(chalk18.grey(`Skipping import of ${resourceName}`));
|
|
313336
313662
|
return void 0;
|
|
313337
313663
|
}
|
|
313338
313664
|
/**
|
|
@@ -313369,11 +313695,11 @@ var init_importer = __esm({
|
|
|
313369
313695
|
});
|
|
313370
313696
|
|
|
313371
313697
|
// ../toolkit-lib/lib/api/resource-import/migrator.ts
|
|
313372
|
-
var
|
|
313698
|
+
var chalk19, fs31, ResourceMigrator;
|
|
313373
313699
|
var init_migrator = __esm({
|
|
313374
313700
|
"../toolkit-lib/lib/api/resource-import/migrator.ts"() {
|
|
313375
313701
|
"use strict";
|
|
313376
|
-
|
|
313702
|
+
chalk19 = __toESM(require_source());
|
|
313377
313703
|
fs31 = __toESM(require_lib4());
|
|
313378
313704
|
init_importer();
|
|
313379
313705
|
init_util();
|
|
@@ -313402,11 +313728,11 @@ var init_migrator = __esm({
|
|
|
313402
313728
|
});
|
|
313403
313729
|
const resourcesToImport = await this.tryGetResources(await migrateDeployment.resolveEnvironment());
|
|
313404
313730
|
if (resourcesToImport) {
|
|
313405
|
-
await this.ioHelper.defaults.info(`${
|
|
313406
|
-
await this.ioHelper.defaults.info(`${
|
|
313731
|
+
await this.ioHelper.defaults.info(`${chalk19.bold(stack.displayName)}: creating stack for resource migration...`);
|
|
313732
|
+
await this.ioHelper.defaults.info(`${chalk19.bold(stack.displayName)}: importing resources into stack...`);
|
|
313407
313733
|
await this.performResourceMigration(migrateDeployment, resourcesToImport, options);
|
|
313408
313734
|
fs31.rmSync("migrate.json");
|
|
313409
|
-
await this.ioHelper.defaults.info(`${
|
|
313735
|
+
await this.ioHelper.defaults.info(`${chalk19.bold(stack.displayName)}: applying CDKMetadata and Outputs to stack (if applicable)...`);
|
|
313410
313736
|
}
|
|
313411
313737
|
}
|
|
313412
313738
|
/**
|
|
@@ -313454,38 +313780,6 @@ var init_resource_import = __esm({
|
|
|
313454
313780
|
}
|
|
313455
313781
|
});
|
|
313456
313782
|
|
|
313457
|
-
// ../toolkit-lib/lib/api/streams.ts
|
|
313458
|
-
var import_node_stream2, StringWriteStream;
|
|
313459
|
-
var init_streams = __esm({
|
|
313460
|
-
"../toolkit-lib/lib/api/streams.ts"() {
|
|
313461
|
-
"use strict";
|
|
313462
|
-
import_node_stream2 = require("node:stream");
|
|
313463
|
-
StringWriteStream = class extends import_node_stream2.Writable {
|
|
313464
|
-
static {
|
|
313465
|
-
__name(this, "StringWriteStream");
|
|
313466
|
-
}
|
|
313467
|
-
buffer = [];
|
|
313468
|
-
/**
|
|
313469
|
-
* Terminal width in columns.
|
|
313470
|
-
* Used by formatTable() to apply width constraints and prevent table overflow.
|
|
313471
|
-
*/
|
|
313472
|
-
get columns() {
|
|
313473
|
-
return process.stdout.columns;
|
|
313474
|
-
}
|
|
313475
|
-
constructor() {
|
|
313476
|
-
super();
|
|
313477
|
-
}
|
|
313478
|
-
_write(chunk, _encoding, callback) {
|
|
313479
|
-
this.buffer.push(chunk.toString());
|
|
313480
|
-
callback();
|
|
313481
|
-
}
|
|
313482
|
-
toString() {
|
|
313483
|
-
return this.buffer.join("");
|
|
313484
|
-
}
|
|
313485
|
-
};
|
|
313486
|
-
}
|
|
313487
|
-
});
|
|
313488
|
-
|
|
313489
313783
|
// ../toolkit-lib/lib/api/refactoring/cloudformation.ts
|
|
313490
313784
|
var ResourceLocation, ResourceMapping;
|
|
313491
313785
|
var init_cloudformation3 = __esm({
|
|
@@ -314130,13 +314424,13 @@ async function listStacks(sdkProvider, environment) {
|
|
|
314130
314424
|
}
|
|
314131
314425
|
function formatEnvironmentSectionHeader2(environment) {
|
|
314132
314426
|
const env = `aws://${environment.account}/${environment.region}`;
|
|
314133
|
-
return formatToStream((stream) => (0,
|
|
314427
|
+
return formatToStream((stream) => (0, import_cloudformation_diff2.formatEnvironmentSectionHeader)(stream, env));
|
|
314134
314428
|
}
|
|
314135
314429
|
function formatTypedMappings2(mappings) {
|
|
314136
|
-
return formatToStream((stream) => (0,
|
|
314430
|
+
return formatToStream((stream) => (0, import_cloudformation_diff2.formatTypedMappings)(stream, mappings));
|
|
314137
314431
|
}
|
|
314138
314432
|
function formatAmbiguousMappings2(paths) {
|
|
314139
|
-
return formatToStream((stream) => (0,
|
|
314433
|
+
return formatToStream((stream) => (0, import_cloudformation_diff2.formatAmbiguousMappings)(stream, paths));
|
|
314140
314434
|
}
|
|
314141
314435
|
function formatToStream(cb) {
|
|
314142
314436
|
const stream = new StringWriteStream();
|
|
@@ -314171,11 +314465,11 @@ async function groupStacks(sdkProvider, localStacks, additionalStackNames) {
|
|
|
314171
314465
|
}
|
|
314172
314466
|
return groups;
|
|
314173
314467
|
}
|
|
314174
|
-
var
|
|
314468
|
+
var import_cloudformation_diff2;
|
|
314175
314469
|
var init_refactoring = __esm({
|
|
314176
314470
|
"../toolkit-lib/lib/api/refactoring/index.ts"() {
|
|
314177
314471
|
"use strict";
|
|
314178
|
-
|
|
314472
|
+
import_cloudformation_diff2 = __toESM(require_lib11());
|
|
314179
314473
|
init_util();
|
|
314180
314474
|
init_plugin2();
|
|
314181
314475
|
init_streams();
|
|
@@ -315056,272 +315350,6 @@ var init_bootstrap3 = __esm({
|
|
|
315056
315350
|
}
|
|
315057
315351
|
});
|
|
315058
315352
|
|
|
315059
|
-
// ../toolkit-lib/lib/api/diff/diff-formatter.ts
|
|
315060
|
-
function permissionTypeFromDiff(diff) {
|
|
315061
|
-
if (diff.permissionsBroadened) {
|
|
315062
|
-
return "broadening" /* BROADENING */;
|
|
315063
|
-
} else if (diff.permissionsAnyChanges) {
|
|
315064
|
-
return "non-broadening" /* NON_BROADENING */;
|
|
315065
|
-
}
|
|
315066
|
-
return "none" /* NONE */;
|
|
315067
|
-
}
|
|
315068
|
-
function buildLogicalToPathMap(stack) {
|
|
315069
|
-
const map2 = {};
|
|
315070
|
-
for (const md of stack.findMetadataByType(cxschema9.ArtifactMetadataEntryType.LOGICAL_ID)) {
|
|
315071
|
-
map2[md.data] = md.path;
|
|
315072
|
-
}
|
|
315073
|
-
return map2;
|
|
315074
|
-
}
|
|
315075
|
-
function logicalIdMapFromTemplate(template) {
|
|
315076
|
-
const ret = {};
|
|
315077
|
-
for (const [logicalId, resource] of Object.entries(template.Resources ?? {})) {
|
|
315078
|
-
const path38 = resource?.Metadata?.["aws:cdk:path"];
|
|
315079
|
-
if (path38) {
|
|
315080
|
-
ret[logicalId] = path38;
|
|
315081
|
-
}
|
|
315082
|
-
}
|
|
315083
|
-
return ret;
|
|
315084
|
-
}
|
|
315085
|
-
function obscureDiff(diff) {
|
|
315086
|
-
if (diff.unknown) {
|
|
315087
|
-
diff.unknown = diff.unknown.filter((change) => {
|
|
315088
|
-
if (!change) {
|
|
315089
|
-
return true;
|
|
315090
|
-
}
|
|
315091
|
-
if (change.newValue?.CheckBootstrapVersion) {
|
|
315092
|
-
return false;
|
|
315093
|
-
}
|
|
315094
|
-
if (change.oldValue?.CheckBootstrapVersion) {
|
|
315095
|
-
return false;
|
|
315096
|
-
}
|
|
315097
|
-
return true;
|
|
315098
|
-
});
|
|
315099
|
-
}
|
|
315100
|
-
if (diff.resources) {
|
|
315101
|
-
diff.resources = diff.resources.filter((change) => {
|
|
315102
|
-
if (!change) {
|
|
315103
|
-
return true;
|
|
315104
|
-
}
|
|
315105
|
-
if (change.newResourceType === "AWS::CDK::Metadata") {
|
|
315106
|
-
return false;
|
|
315107
|
-
}
|
|
315108
|
-
if (change.oldResourceType === "AWS::CDK::Metadata") {
|
|
315109
|
-
return false;
|
|
315110
|
-
}
|
|
315111
|
-
return true;
|
|
315112
|
-
});
|
|
315113
|
-
}
|
|
315114
|
-
}
|
|
315115
|
-
var import_node_util3, cxschema9, import_cloudformation_diff2, chalk19, DiffFormatter;
|
|
315116
|
-
var init_diff_formatter = __esm({
|
|
315117
|
-
"../toolkit-lib/lib/api/diff/diff-formatter.ts"() {
|
|
315118
|
-
"use strict";
|
|
315119
|
-
import_node_util3 = require("node:util");
|
|
315120
|
-
cxschema9 = __toESM(require_lib2());
|
|
315121
|
-
import_cloudformation_diff2 = __toESM(require_lib11());
|
|
315122
|
-
chalk19 = __toESM(require_source());
|
|
315123
|
-
init_payloads();
|
|
315124
|
-
init_streams();
|
|
315125
|
-
DiffFormatter = class {
|
|
315126
|
-
static {
|
|
315127
|
-
__name(this, "DiffFormatter");
|
|
315128
|
-
}
|
|
315129
|
-
templateInfo;
|
|
315130
|
-
stackName;
|
|
315131
|
-
isImport;
|
|
315132
|
-
mappings;
|
|
315133
|
-
/**
|
|
315134
|
-
* Cache of computed TemplateDiffs, indexed by stack name.
|
|
315135
|
-
*/
|
|
315136
|
-
cache = /* @__PURE__ */ new Map();
|
|
315137
|
-
constructor(props) {
|
|
315138
|
-
this.templateInfo = props.templateInfo;
|
|
315139
|
-
this.stackName = props.templateInfo.newTemplate.displayName ?? props.templateInfo.newTemplate.stackName;
|
|
315140
|
-
this.isImport = props.templateInfo.isImport ?? false;
|
|
315141
|
-
this.mappings = props.templateInfo.mappings ?? {};
|
|
315142
|
-
}
|
|
315143
|
-
get diffs() {
|
|
315144
|
-
return Object.fromEntries(this.cache);
|
|
315145
|
-
}
|
|
315146
|
-
/**
|
|
315147
|
-
* Compute the diff for a single stack. Results are cached by stack name.
|
|
315148
|
-
*
|
|
315149
|
-
* @param stackName - The name to cache the diff under
|
|
315150
|
-
* @param oldTemplate - The deployed template
|
|
315151
|
-
* @param newTemplate - The new/generated template (read from the artifact)
|
|
315152
|
-
* @param changeSet - The CloudFormation changeset for this specific stack, if available
|
|
315153
|
-
* @param mappings - Resource move mappings
|
|
315154
|
-
*/
|
|
315155
|
-
computeDiff(stackName, oldTemplate, newTemplate, changeSet, mappings) {
|
|
315156
|
-
if (!this.cache.has(stackName)) {
|
|
315157
|
-
const templateDiff = (0, import_cloudformation_diff2.fullDiff)(oldTemplate, newTemplate, changeSet, this.isImport);
|
|
315158
|
-
const setMove = /* @__PURE__ */ __name((change, direction, location) => {
|
|
315159
|
-
if (location != null) {
|
|
315160
|
-
const [sourceStackName, sourceLogicalId] = location.split(".");
|
|
315161
|
-
change.move = {
|
|
315162
|
-
direction,
|
|
315163
|
-
stackName: sourceStackName,
|
|
315164
|
-
resourceLogicalId: sourceLogicalId
|
|
315165
|
-
};
|
|
315166
|
-
}
|
|
315167
|
-
}, "setMove");
|
|
315168
|
-
templateDiff.resources.forEachDifference((id, change) => {
|
|
315169
|
-
const location = `${stackName}.${id}`;
|
|
315170
|
-
if (change.isAddition && Object.values(mappings).includes(location)) {
|
|
315171
|
-
setMove(change, "from", Object.keys(mappings).find((k6) => mappings[k6] === location));
|
|
315172
|
-
} else if (change.isRemoval && Object.keys(mappings).includes(location)) {
|
|
315173
|
-
setMove(change, "to", mappings[location]);
|
|
315174
|
-
}
|
|
315175
|
-
});
|
|
315176
|
-
this.cache.set(stackName, templateDiff);
|
|
315177
|
-
}
|
|
315178
|
-
return this.cache.get(stackName);
|
|
315179
|
-
}
|
|
315180
|
-
/**
|
|
315181
|
-
* Format the stack diff, including all nested stacks.
|
|
315182
|
-
*/
|
|
315183
|
-
formatStackDiff(options = {}) {
|
|
315184
|
-
return this.formatStackDiffHelper({
|
|
315185
|
-
oldTemplate: this.templateInfo.oldTemplate,
|
|
315186
|
-
newTemplate: this.templateInfo.newTemplate.template,
|
|
315187
|
-
stackName: this.stackName,
|
|
315188
|
-
nestedStacks: this.templateInfo.nestedStacks,
|
|
315189
|
-
changeSet: this.templateInfo.changeSet,
|
|
315190
|
-
mappings: this.mappings,
|
|
315191
|
-
logicalIdMap: buildLogicalToPathMap(this.templateInfo.newTemplate)
|
|
315192
|
-
}, options);
|
|
315193
|
-
}
|
|
315194
|
-
formatStackDiffHelper(params, options = {}) {
|
|
315195
|
-
const { oldTemplate, newTemplate, stackName, nestedStacks, changeSet, mappings, logicalIdMap } = params;
|
|
315196
|
-
const diff = this.computeDiff(stackName, oldTemplate, newTemplate, changeSet, mappings);
|
|
315197
|
-
const stream = new StringWriteStream();
|
|
315198
|
-
let numStacksWithChanges = 0;
|
|
315199
|
-
let formattedDiff = "";
|
|
315200
|
-
let filteredChangesCount = 0;
|
|
315201
|
-
try {
|
|
315202
|
-
if (stackName && (!options.quiet || !diff.isEmpty)) {
|
|
315203
|
-
stream.write((0, import_node_util3.format)(`Stack ${chalk19.bold(stackName)}
|
|
315204
|
-
`));
|
|
315205
|
-
}
|
|
315206
|
-
if (!options.quiet && this.isImport) {
|
|
315207
|
-
stream.write("Parameters and rules created during migration do not affect resource configuration.\n");
|
|
315208
|
-
}
|
|
315209
|
-
let activeDiff = diff;
|
|
315210
|
-
if (diff.differenceCount && !options.strict) {
|
|
315211
|
-
const mangledNewTemplate = JSON.parse((0, import_cloudformation_diff2.mangleLikeCloudFormation)(JSON.stringify(newTemplate)));
|
|
315212
|
-
const mangledDiff = (0, import_cloudformation_diff2.fullDiff)(oldTemplate, mangledNewTemplate, changeSet);
|
|
315213
|
-
filteredChangesCount = Math.max(0, diff.differenceCount - mangledDiff.differenceCount);
|
|
315214
|
-
if (filteredChangesCount > 0) {
|
|
315215
|
-
activeDiff = mangledDiff;
|
|
315216
|
-
}
|
|
315217
|
-
}
|
|
315218
|
-
if (!options.strict) {
|
|
315219
|
-
obscureDiff(activeDiff);
|
|
315220
|
-
}
|
|
315221
|
-
if (!activeDiff.isEmpty) {
|
|
315222
|
-
numStacksWithChanges++;
|
|
315223
|
-
(0, import_cloudformation_diff2.formatDifferences)(stream, activeDiff, {
|
|
315224
|
-
...logicalIdMapFromTemplate(oldTemplate),
|
|
315225
|
-
...logicalIdMapFromTemplate(newTemplate),
|
|
315226
|
-
...logicalIdMap
|
|
315227
|
-
}, options.contextLines);
|
|
315228
|
-
} else if (!options.quiet) {
|
|
315229
|
-
stream.write(chalk19.green("There were no differences\n"));
|
|
315230
|
-
}
|
|
315231
|
-
if (filteredChangesCount > 0) {
|
|
315232
|
-
stream.write(chalk19.yellow(`Omitted ${filteredChangesCount} changes because they are likely mangled non-ASCII characters. Use --strict to print them.
|
|
315233
|
-
`));
|
|
315234
|
-
}
|
|
315235
|
-
} finally {
|
|
315236
|
-
formattedDiff = stream.toString();
|
|
315237
|
-
stream.end();
|
|
315238
|
-
}
|
|
315239
|
-
for (const [logicalId, nestedStack] of Object.entries(nestedStacks ?? {})) {
|
|
315240
|
-
const nextDiff = this.formatStackDiffHelper({
|
|
315241
|
-
oldTemplate: nestedStack.deployedTemplate,
|
|
315242
|
-
newTemplate: nestedStack.generatedTemplate,
|
|
315243
|
-
stackName: nestedStack.physicalName ?? logicalId,
|
|
315244
|
-
nestedStacks: nestedStack.nestedStackTemplates,
|
|
315245
|
-
changeSet: nestedStack.changeSet,
|
|
315246
|
-
mappings,
|
|
315247
|
-
logicalIdMap: {}
|
|
315248
|
-
}, options);
|
|
315249
|
-
numStacksWithChanges += nextDiff.numStacksWithChanges;
|
|
315250
|
-
formattedDiff += nextDiff.formattedDiff;
|
|
315251
|
-
}
|
|
315252
|
-
return { numStacksWithChanges, formattedDiff };
|
|
315253
|
-
}
|
|
315254
|
-
/**
|
|
315255
|
-
* Format the security diff, including all nested stacks.
|
|
315256
|
-
*/
|
|
315257
|
-
formatSecurityDiff(options = {}) {
|
|
315258
|
-
const { formattedDiff, permissionChangeType, numStacksWithChanges } = this.formatSecurityDiffHelper({
|
|
315259
|
-
oldTemplate: this.templateInfo.oldTemplate,
|
|
315260
|
-
newTemplate: this.templateInfo.newTemplate.template,
|
|
315261
|
-
stackName: this.stackName,
|
|
315262
|
-
nestedStacks: this.templateInfo.nestedStacks,
|
|
315263
|
-
changeSet: this.templateInfo.changeSet,
|
|
315264
|
-
logicalIdMap: buildLogicalToPathMap(this.templateInfo.newTemplate)
|
|
315265
|
-
}, options);
|
|
315266
|
-
return { formattedDiff, permissionChangeType, numStacksWithChanges };
|
|
315267
|
-
}
|
|
315268
|
-
formatSecurityDiffHelper(params, options = {}) {
|
|
315269
|
-
const { oldTemplate, newTemplate, stackName, nestedStacks, changeSet, logicalIdMap } = params;
|
|
315270
|
-
const diff = this.computeDiff(stackName, oldTemplate, newTemplate, changeSet, this.mappings);
|
|
315271
|
-
const permissionChangeType = permissionTypeFromDiff(diff);
|
|
315272
|
-
const stream = new StringWriteStream();
|
|
315273
|
-
if (!options.quiet || permissionChangeType !== "none" /* NONE */) {
|
|
315274
|
-
stream.write((0, import_node_util3.format)(`Stack ${chalk19.bold(stackName)}
|
|
315275
|
-
`));
|
|
315276
|
-
}
|
|
315277
|
-
try {
|
|
315278
|
-
(0, import_cloudformation_diff2.formatSecurityChanges)(stream, diff, {
|
|
315279
|
-
...logicalIdMapFromTemplate(newTemplate),
|
|
315280
|
-
...logicalIdMap
|
|
315281
|
-
});
|
|
315282
|
-
} finally {
|
|
315283
|
-
stream.end();
|
|
315284
|
-
}
|
|
315285
|
-
let formattedDiff = stream.toString();
|
|
315286
|
-
if (!options.quiet && permissionChangeType === "none" /* NONE */) {
|
|
315287
|
-
formattedDiff += chalk19.green("There were no security-related changes (limitations: https://github.com/aws/aws-cdk/issues/1299)\n");
|
|
315288
|
-
}
|
|
315289
|
-
let numStacksWithChanges = permissionChangeType !== "none" /* NONE */ ? 1 : 0;
|
|
315290
|
-
let escalatedPermissionType = permissionChangeType;
|
|
315291
|
-
for (const [logicalId, nestedStack] of Object.entries(nestedStacks ?? {})) {
|
|
315292
|
-
const nestedResult = this.formatSecurityDiffHelper({
|
|
315293
|
-
oldTemplate: nestedStack.deployedTemplate,
|
|
315294
|
-
newTemplate: nestedStack.generatedTemplate,
|
|
315295
|
-
stackName: nestedStack.physicalName ?? logicalId,
|
|
315296
|
-
nestedStacks: nestedStack.nestedStackTemplates,
|
|
315297
|
-
changeSet: nestedStack.changeSet
|
|
315298
|
-
}, options);
|
|
315299
|
-
formattedDiff += nestedResult.formattedDiff ? "\n" + nestedResult.formattedDiff : "";
|
|
315300
|
-
numStacksWithChanges += nestedResult.numStacksWithChanges;
|
|
315301
|
-
if (nestedResult.permissionChangeType === "broadening" /* BROADENING */) {
|
|
315302
|
-
escalatedPermissionType = "broadening" /* BROADENING */;
|
|
315303
|
-
} else if (nestedResult.permissionChangeType === "non-broadening" /* NON_BROADENING */ && escalatedPermissionType === "none" /* NONE */) {
|
|
315304
|
-
escalatedPermissionType = "non-broadening" /* NON_BROADENING */;
|
|
315305
|
-
}
|
|
315306
|
-
}
|
|
315307
|
-
return { formattedDiff, permissionChangeType: escalatedPermissionType, numStacksWithChanges };
|
|
315308
|
-
}
|
|
315309
|
-
};
|
|
315310
|
-
__name(permissionTypeFromDiff, "permissionTypeFromDiff");
|
|
315311
|
-
__name(buildLogicalToPathMap, "buildLogicalToPathMap");
|
|
315312
|
-
__name(logicalIdMapFromTemplate, "logicalIdMapFromTemplate");
|
|
315313
|
-
__name(obscureDiff, "obscureDiff");
|
|
315314
|
-
}
|
|
315315
|
-
});
|
|
315316
|
-
|
|
315317
|
-
// ../toolkit-lib/lib/api/diff/index.ts
|
|
315318
|
-
var init_diff4 = __esm({
|
|
315319
|
-
"../toolkit-lib/lib/api/diff/index.ts"() {
|
|
315320
|
-
"use strict";
|
|
315321
|
-
init_diff_formatter();
|
|
315322
|
-
}
|
|
315323
|
-
});
|
|
315324
|
-
|
|
315325
315353
|
// ../toolkit-lib/lib/api/drift/drift-formatter.ts
|
|
315326
315354
|
var import_node_util4, cxschema10, import_cloudformation_diff3, import_client_cloudformation4, chalk20, DriftFormatter, ADDITION3, CONTEXT2, UPDATE3, REMOVAL3;
|
|
315327
315355
|
var init_drift_formatter = __esm({
|
|
@@ -317191,33 +317219,35 @@ var init_toolkit = __esm({
|
|
|
317191
317219
|
deploymentMethod: options.deploymentMethod,
|
|
317192
317220
|
cleanupOnNoOp: isExecutingChangeSetDeployment(options.deploymentMethod)
|
|
317193
317221
|
}) : void 0;
|
|
317194
|
-
|
|
317195
|
-
|
|
317196
|
-
|
|
317197
|
-
|
|
317198
|
-
|
|
317199
|
-
|
|
317200
|
-
|
|
317201
|
-
|
|
317202
|
-
|
|
317203
|
-
|
|
317204
|
-
|
|
317205
|
-
|
|
317206
|
-
|
|
317222
|
+
if (!prepareResult?.noOp) {
|
|
317223
|
+
const formatter = new DiffFormatter({
|
|
317224
|
+
templateInfo: {
|
|
317225
|
+
oldTemplate: currentTemplate,
|
|
317226
|
+
newTemplate: stack,
|
|
317227
|
+
changeSet: prepareResult?.changeSet
|
|
317228
|
+
}
|
|
317229
|
+
});
|
|
317230
|
+
const securityDiff = formatter.formatSecurityDiff();
|
|
317231
|
+
const stackDiff = formatter.formatStackDiff();
|
|
317232
|
+
const hasSecurityChanges = securityDiff.permissionChangeType !== "none" /* NONE */;
|
|
317233
|
+
const deployMotivation = hasSecurityChanges ? '"--require-approval" is enabled and stack includes security-sensitive updates.' : '"--require-approval" is enabled and stack includes updates.';
|
|
317234
|
+
const diffOutput2 = hasSecurityChanges ? securityDiff.formattedDiff : stackDiff.formattedDiff;
|
|
317235
|
+
const deployQuestion = `${diffOutput2}
|
|
317207
317236
|
|
|
317208
317237
|
${deployMotivation}
|
|
317209
317238
|
Do you wish to deploy these changes`;
|
|
317210
|
-
|
|
317211
|
-
|
|
317212
|
-
|
|
317213
|
-
|
|
317214
|
-
|
|
317215
|
-
|
|
317216
|
-
|
|
317217
|
-
|
|
317218
|
-
|
|
317239
|
+
const deployConfirmed = await ioHelper.requestResponse(IO.CDK_TOOLKIT_I5060.req(deployQuestion, {
|
|
317240
|
+
motivation: deployMotivation,
|
|
317241
|
+
concurrency,
|
|
317242
|
+
permissionChangeType: securityDiff.permissionChangeType,
|
|
317243
|
+
templateDiffs: formatter.diffs
|
|
317244
|
+
}));
|
|
317245
|
+
if (!deployConfirmed) {
|
|
317246
|
+
if (prepareResult?.changeSet?.ChangeSetName) {
|
|
317247
|
+
await deployments.cleanupChangeSet(stack, prepareResult.changeSet.ChangeSetName);
|
|
317248
|
+
}
|
|
317249
|
+
throw new ToolkitError("DeployAborted", "Aborted by user");
|
|
317219
317250
|
}
|
|
317220
|
-
throw new ToolkitError("DeployAborted", "Aborted by user");
|
|
317221
317251
|
}
|
|
317222
317252
|
const stackIndex = stacks.indexOf(stack) + 1;
|
|
317223
317253
|
const deploySpan = await ioHelper.span(SPAN.DEPLOY_STACK).begin(`${chalk23.bold(stack.displayName)}: deploying... [${stackIndex}/${stackCollection.stackCount}]`, {
|
package/package.json
CHANGED
|
@@ -66,11 +66,11 @@
|
|
|
66
66
|
"@aws-cdk/aws-service-spec": "^0.1.171",
|
|
67
67
|
"@aws-cdk/cdk-assets-lib": "1.4.5",
|
|
68
68
|
"@aws-cdk/cloud-assembly-api": "2.2.2",
|
|
69
|
-
"@aws-cdk/cloud-assembly-schema": ">=53.
|
|
69
|
+
"@aws-cdk/cloud-assembly-schema": ">=53.18.0",
|
|
70
70
|
"@aws-cdk/cloudformation-diff": "2.187.1",
|
|
71
|
-
"@aws-cdk/toolkit-lib": "1.
|
|
71
|
+
"@aws-cdk/toolkit-lib": "1.24.0",
|
|
72
72
|
"@aws-sdk/client-cloudformation": "^3",
|
|
73
|
-
"aws-cdk": "2.
|
|
73
|
+
"aws-cdk": "2.1119.0",
|
|
74
74
|
"chalk": "^4",
|
|
75
75
|
"chokidar": "^4",
|
|
76
76
|
"fs-extra": "^11",
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
},
|
|
81
81
|
"dependencies": {
|
|
82
82
|
"@aws-cdk/aws-service-spec": "0.1.171",
|
|
83
|
-
"aws-cdk": "2.
|
|
83
|
+
"aws-cdk": "2.1119.0"
|
|
84
84
|
},
|
|
85
85
|
"keywords": [
|
|
86
86
|
"aws",
|
|
@@ -102,7 +102,7 @@
|
|
|
102
102
|
"publishConfig": {
|
|
103
103
|
"access": "public"
|
|
104
104
|
},
|
|
105
|
-
"version": "2.197.
|
|
105
|
+
"version": "2.197.18",
|
|
106
106
|
"packageManager": "yarn@4.13.0",
|
|
107
107
|
"types": "lib/index.d.ts",
|
|
108
108
|
"//": "~~ Generated by projen. To modify, edit .projenrc.js and run \"yarn projen\"."
|