aws-cdk 2.1028.0 → 2.1029.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/README.md +13 -3
- package/build-info.json +2 -2
- package/lib/cli/cdk-toolkit.d.ts +9 -1
- package/lib/cli/cdk-toolkit.js +3 -1
- package/lib/cli/cli-config.js +7 -2
- package/lib/cli/cli-type-registry.json +5 -0
- package/lib/cli/cli.js +34 -3
- package/lib/cli/convert-to-user-input.js +3 -1
- package/lib/cli/parse-command-line-arguments.js +7 -2
- package/lib/cli/user-input.d.ts +6 -0
- package/lib/cli/user-input.js +1 -1
- package/lib/cli/util/yargs-helpers.d.ts +0 -10
- package/lib/cli/util/yargs-helpers.js +3 -18
- package/lib/commands/flag-operations.js +6 -2
- package/lib/index.js +381 -90
- package/package.json +4 -4
package/lib/index.js
CHANGED
|
@@ -3478,7 +3478,7 @@ var require_semver2 = __commonJS({
|
|
|
3478
3478
|
// ../@aws-cdk/cloud-assembly-schema/cli-version.json
|
|
3479
3479
|
var require_cli_version = __commonJS({
|
|
3480
3480
|
"../@aws-cdk/cloud-assembly-schema/cli-version.json"(exports2, module2) {
|
|
3481
|
-
module2.exports = { version: "2.
|
|
3481
|
+
module2.exports = { version: "2.1029.0" };
|
|
3482
3482
|
}
|
|
3483
3483
|
});
|
|
3484
3484
|
|
|
@@ -8759,7 +8759,7 @@ var require_placeholders = __commonJS({
|
|
|
8759
8759
|
exports2.EnvironmentPlaceholders = void 0;
|
|
8760
8760
|
var jsiiDeprecationWarnings = require_warnings_jsii();
|
|
8761
8761
|
var JSII_RTTI_SYMBOL_1 = Symbol.for("jsii.rtti");
|
|
8762
|
-
var
|
|
8762
|
+
var EnvironmentPlaceholders5 = class _EnvironmentPlaceholders {
|
|
8763
8763
|
static {
|
|
8764
8764
|
__name(this, "EnvironmentPlaceholders");
|
|
8765
8765
|
}
|
|
@@ -8839,12 +8839,12 @@ var require_placeholders = __commonJS({
|
|
|
8839
8839
|
return ret;
|
|
8840
8840
|
}
|
|
8841
8841
|
};
|
|
8842
|
-
exports2.EnvironmentPlaceholders =
|
|
8842
|
+
exports2.EnvironmentPlaceholders = EnvironmentPlaceholders5;
|
|
8843
8843
|
_a2 = JSII_RTTI_SYMBOL_1;
|
|
8844
|
-
|
|
8845
|
-
|
|
8846
|
-
|
|
8847
|
-
|
|
8844
|
+
EnvironmentPlaceholders5[_a2] = { fqn: "@aws-cdk/cx-api.EnvironmentPlaceholders", version: "2.213.0" };
|
|
8845
|
+
EnvironmentPlaceholders5.CURRENT_REGION = "${AWS::Region}";
|
|
8846
|
+
EnvironmentPlaceholders5.CURRENT_ACCOUNT = "${AWS::AccountId}";
|
|
8847
|
+
EnvironmentPlaceholders5.CURRENT_PARTITION = "${AWS::Partition}";
|
|
8848
8848
|
function replaceAll(s3, search, replace) {
|
|
8849
8849
|
return s3.split(search).join(replace);
|
|
8850
8850
|
}
|
|
@@ -123484,6 +123484,11 @@ var init_messages = __esm({
|
|
|
123484
123484
|
description: "Refactor result",
|
|
123485
123485
|
interface: "RefactorResult"
|
|
123486
123486
|
}),
|
|
123487
|
+
CDK_TOOLKIT_I8910: question({
|
|
123488
|
+
code: "CDK_TOOLKIT_I8910",
|
|
123489
|
+
description: "Confirm refactor",
|
|
123490
|
+
interface: "ConfirmationRequest"
|
|
123491
|
+
}),
|
|
123487
123492
|
CDK_TOOLKIT_W8010: warn({
|
|
123488
123493
|
code: "CDK_TOOLKIT_W8010",
|
|
123489
123494
|
description: "Refactor execution not yet supported"
|
|
@@ -124372,7 +124377,7 @@ var require_dist_cjs80 = __commonJS({
|
|
|
124372
124377
|
CreateGeneratedTemplateCommand: /* @__PURE__ */ __name(() => CreateGeneratedTemplateCommand2, "CreateGeneratedTemplateCommand"),
|
|
124373
124378
|
CreateStackCommand: /* @__PURE__ */ __name(() => CreateStackCommand2, "CreateStackCommand"),
|
|
124374
124379
|
CreateStackInstancesCommand: /* @__PURE__ */ __name(() => CreateStackInstancesCommand, "CreateStackInstancesCommand"),
|
|
124375
|
-
CreateStackRefactorCommand: /* @__PURE__ */ __name(() =>
|
|
124380
|
+
CreateStackRefactorCommand: /* @__PURE__ */ __name(() => CreateStackRefactorCommand2, "CreateStackRefactorCommand"),
|
|
124376
124381
|
CreateStackSetCommand: /* @__PURE__ */ __name(() => CreateStackSetCommand, "CreateStackSetCommand"),
|
|
124377
124382
|
CreatedButModifiedException: /* @__PURE__ */ __name(() => CreatedButModifiedException, "CreatedButModifiedException"),
|
|
124378
124383
|
DeactivateOrganizationsAccessCommand: /* @__PURE__ */ __name(() => DeactivateOrganizationsAccessCommand, "DeactivateOrganizationsAccessCommand"),
|
|
@@ -124412,7 +124417,7 @@ var require_dist_cjs80 = __commonJS({
|
|
|
124412
124417
|
EstimateTemplateCostCommand: /* @__PURE__ */ __name(() => EstimateTemplateCostCommand, "EstimateTemplateCostCommand"),
|
|
124413
124418
|
EvaluationType: /* @__PURE__ */ __name(() => EvaluationType, "EvaluationType"),
|
|
124414
124419
|
ExecuteChangeSetCommand: /* @__PURE__ */ __name(() => ExecuteChangeSetCommand2, "ExecuteChangeSetCommand"),
|
|
124415
|
-
ExecuteStackRefactorCommand: /* @__PURE__ */ __name(() =>
|
|
124420
|
+
ExecuteStackRefactorCommand: /* @__PURE__ */ __name(() => ExecuteStackRefactorCommand2, "ExecuteStackRefactorCommand"),
|
|
124416
124421
|
ExecutionStatus: /* @__PURE__ */ __name(() => ExecutionStatus, "ExecutionStatus"),
|
|
124417
124422
|
GeneratedTemplateDeletionPolicy: /* @__PURE__ */ __name(() => GeneratedTemplateDeletionPolicy, "GeneratedTemplateDeletionPolicy"),
|
|
124418
124423
|
GeneratedTemplateNotFoundException: /* @__PURE__ */ __name(() => GeneratedTemplateNotFoundException, "GeneratedTemplateNotFoundException"),
|
|
@@ -124575,8 +124580,8 @@ var require_dist_cjs80 = __commonJS({
|
|
|
124575
124580
|
waitUntilStackDeleteComplete: /* @__PURE__ */ __name(() => waitUntilStackDeleteComplete, "waitUntilStackDeleteComplete"),
|
|
124576
124581
|
waitUntilStackExists: /* @__PURE__ */ __name(() => waitUntilStackExists, "waitUntilStackExists"),
|
|
124577
124582
|
waitUntilStackImportComplete: /* @__PURE__ */ __name(() => waitUntilStackImportComplete, "waitUntilStackImportComplete"),
|
|
124578
|
-
waitUntilStackRefactorCreateComplete: /* @__PURE__ */ __name(() =>
|
|
124579
|
-
waitUntilStackRefactorExecuteComplete: /* @__PURE__ */ __name(() =>
|
|
124583
|
+
waitUntilStackRefactorCreateComplete: /* @__PURE__ */ __name(() => waitUntilStackRefactorCreateComplete2, "waitUntilStackRefactorCreateComplete"),
|
|
124584
|
+
waitUntilStackRefactorExecuteComplete: /* @__PURE__ */ __name(() => waitUntilStackRefactorExecuteComplete2, "waitUntilStackRefactorExecuteComplete"),
|
|
124580
124585
|
waitUntilStackRollbackComplete: /* @__PURE__ */ __name(() => waitUntilStackRollbackComplete, "waitUntilStackRollbackComplete"),
|
|
124581
124586
|
waitUntilStackUpdateComplete: /* @__PURE__ */ __name(() => waitUntilStackUpdateComplete, "waitUntilStackUpdateComplete"),
|
|
124582
124587
|
waitUntilTypeRegistrationComplete: /* @__PURE__ */ __name(() => waitUntilTypeRegistrationComplete, "waitUntilTypeRegistrationComplete")
|
|
@@ -134668,7 +134673,7 @@ var require_dist_cjs80 = __commonJS({
|
|
|
134668
134673
|
__name2(this, "CreateStackInstancesCommand");
|
|
134669
134674
|
}
|
|
134670
134675
|
};
|
|
134671
|
-
var
|
|
134676
|
+
var CreateStackRefactorCommand2 = class extends import_smithy_client28.Command.classBuilder().ep(commonParams3).m(function(Command2, cs, config, o3) {
|
|
134672
134677
|
return [
|
|
134673
134678
|
(0, import_middleware_serde5.getSerdePlugin)(config, this.serialize, this.deserialize),
|
|
134674
134679
|
(0, import_middleware_endpoint8.getEndpointPlugin)(config, Command2.getEndpointParameterInstructions())
|
|
@@ -135110,7 +135115,7 @@ var require_dist_cjs80 = __commonJS({
|
|
|
135110
135115
|
__name2(this, "ExecuteChangeSetCommand");
|
|
135111
135116
|
}
|
|
135112
135117
|
};
|
|
135113
|
-
var
|
|
135118
|
+
var ExecuteStackRefactorCommand2 = class extends import_smithy_client28.Command.classBuilder().ep(commonParams3).m(function(Command2, cs, config, o3) {
|
|
135114
135119
|
return [
|
|
135115
135120
|
(0, import_middleware_serde5.getSerdePlugin)(config, this.serialize, this.deserialize),
|
|
135116
135121
|
(0, import_middleware_endpoint8.getEndpointPlugin)(config, Command2.getEndpointParameterInstructions())
|
|
@@ -135705,7 +135710,7 @@ var require_dist_cjs80 = __commonJS({
|
|
|
135705
135710
|
CreateGeneratedTemplateCommand: CreateGeneratedTemplateCommand2,
|
|
135706
135711
|
CreateStackCommand: CreateStackCommand2,
|
|
135707
135712
|
CreateStackInstancesCommand,
|
|
135708
|
-
CreateStackRefactorCommand,
|
|
135713
|
+
CreateStackRefactorCommand: CreateStackRefactorCommand2,
|
|
135709
135714
|
CreateStackSetCommand,
|
|
135710
135715
|
DeactivateOrganizationsAccessCommand,
|
|
135711
135716
|
DeactivateTypeCommand,
|
|
@@ -135739,7 +135744,7 @@ var require_dist_cjs80 = __commonJS({
|
|
|
135739
135744
|
DetectStackSetDriftCommand,
|
|
135740
135745
|
EstimateTemplateCostCommand,
|
|
135741
135746
|
ExecuteChangeSetCommand: ExecuteChangeSetCommand2,
|
|
135742
|
-
ExecuteStackRefactorCommand,
|
|
135747
|
+
ExecuteStackRefactorCommand: ExecuteStackRefactorCommand2,
|
|
135743
135748
|
GetGeneratedTemplateCommand: GetGeneratedTemplateCommand2,
|
|
135744
135749
|
GetStackPolicyCommand,
|
|
135745
135750
|
GetTemplateCommand: GetTemplateCommand2,
|
|
@@ -136423,7 +136428,7 @@ var require_dist_cjs80 = __commonJS({
|
|
|
136423
136428
|
const serviceDefaults = { minDelay: 5, maxDelay: 120 };
|
|
136424
136429
|
return (0, import_util_waiter.createWaiter)({ ...serviceDefaults, ...params }, input, checkState6);
|
|
136425
136430
|
}, "waitForStackRefactorCreateComplete");
|
|
136426
|
-
var
|
|
136431
|
+
var waitUntilStackRefactorCreateComplete2 = /* @__PURE__ */ __name2(async (params, input) => {
|
|
136427
136432
|
const serviceDefaults = { minDelay: 5, maxDelay: 120 };
|
|
136428
136433
|
const result2 = await (0, import_util_waiter.createWaiter)({ ...serviceDefaults, ...params }, input, checkState6);
|
|
136429
136434
|
return (0, import_util_waiter.checkExceptions)(result2);
|
|
@@ -136472,7 +136477,7 @@ var require_dist_cjs80 = __commonJS({
|
|
|
136472
136477
|
const serviceDefaults = { minDelay: 15, maxDelay: 120 };
|
|
136473
136478
|
return (0, import_util_waiter.createWaiter)({ ...serviceDefaults, ...params }, input, checkState7);
|
|
136474
136479
|
}, "waitForStackRefactorExecuteComplete");
|
|
136475
|
-
var
|
|
136480
|
+
var waitUntilStackRefactorExecuteComplete2 = /* @__PURE__ */ __name2(async (params, input) => {
|
|
136476
136481
|
const serviceDefaults = { minDelay: 15, maxDelay: 120 };
|
|
136477
136482
|
const result2 = await (0, import_util_waiter.createWaiter)({ ...serviceDefaults, ...params }, input, checkState7);
|
|
136478
136483
|
return (0, import_util_waiter.checkExceptions)(result2);
|
|
@@ -149870,6 +149875,8 @@ function formatAmbiguousMappings(stream3, pairs) {
|
|
|
149870
149875
|
formatter.print("Detected ambiguities:");
|
|
149871
149876
|
formatter.print(tables.join("\n\n"));
|
|
149872
149877
|
formatter.print(" ");
|
|
149878
|
+
formatter.print(chalk7.yellow("Please provide an override file to resolve these ambiguous mappings."));
|
|
149879
|
+
formatter.print(" ");
|
|
149873
149880
|
function renderTable2([removed, added]) {
|
|
149874
149881
|
return formatTable([["", "Resource"], renderRemoval(removed), renderAddition(added)], void 0);
|
|
149875
149882
|
}
|
|
@@ -152446,7 +152453,7 @@ var init_notices = __esm({
|
|
|
152446
152453
|
* Refresh the list of notices this instance is aware of.
|
|
152447
152454
|
*
|
|
152448
152455
|
* This method throws an error if the data source fails to fetch notices.
|
|
152449
|
-
* When using, consider if execution should halt immdiately or if catching the
|
|
152456
|
+
* When using, consider if execution should halt immdiately or if catching the error and continuing is more appropriate
|
|
152450
152457
|
*
|
|
152451
152458
|
* @throws on failure to refresh the data source
|
|
152452
152459
|
*/
|
|
@@ -319079,7 +319086,35 @@ var init_sdk2 = __esm({
|
|
|
319079
319086
|
stackResources.push(...page?.StackSummaries || []);
|
|
319080
319087
|
}
|
|
319081
319088
|
return stackResources;
|
|
319082
|
-
}, "paginatedListStacks")
|
|
319089
|
+
}, "paginatedListStacks"),
|
|
319090
|
+
createStackRefactor: /* @__PURE__ */ __name((input) => {
|
|
319091
|
+
return client.send(new import_client_cloudformation3.CreateStackRefactorCommand(input));
|
|
319092
|
+
}, "createStackRefactor"),
|
|
319093
|
+
executeStackRefactor: /* @__PURE__ */ __name((input) => {
|
|
319094
|
+
return client.send(new import_client_cloudformation3.ExecuteStackRefactorCommand(input));
|
|
319095
|
+
}, "executeStackRefactor"),
|
|
319096
|
+
waitUntilStackRefactorCreateComplete: /* @__PURE__ */ __name((input) => {
|
|
319097
|
+
return (0, import_client_cloudformation3.waitUntilStackRefactorCreateComplete)(
|
|
319098
|
+
{
|
|
319099
|
+
client,
|
|
319100
|
+
maxWaitTime: 600,
|
|
319101
|
+
minDelay: 6,
|
|
319102
|
+
maxDelay: 6
|
|
319103
|
+
},
|
|
319104
|
+
input
|
|
319105
|
+
);
|
|
319106
|
+
}, "waitUntilStackRefactorCreateComplete"),
|
|
319107
|
+
waitUntilStackRefactorExecuteComplete: /* @__PURE__ */ __name((input) => {
|
|
319108
|
+
return (0, import_client_cloudformation3.waitUntilStackRefactorExecuteComplete)(
|
|
319109
|
+
{
|
|
319110
|
+
client,
|
|
319111
|
+
maxWaitTime: 600,
|
|
319112
|
+
minDelay: 6,
|
|
319113
|
+
maxDelay: 6
|
|
319114
|
+
},
|
|
319115
|
+
input
|
|
319116
|
+
);
|
|
319117
|
+
}, "waitUntilStackRefactorExecuteComplete")
|
|
319083
319118
|
};
|
|
319084
319119
|
}
|
|
319085
319120
|
cloudWatchLogs() {
|
|
@@ -321385,10 +321420,14 @@ function equalSets(a3, b3) {
|
|
|
321385
321420
|
}
|
|
321386
321421
|
return true;
|
|
321387
321422
|
}
|
|
321423
|
+
function setDiff(a3, b3) {
|
|
321424
|
+
return new Set(Array.from(a3).filter((x3) => !b3.has(x3)));
|
|
321425
|
+
}
|
|
321388
321426
|
var init_sets = __esm({
|
|
321389
321427
|
"../@aws-cdk/toolkit-lib/lib/util/sets.ts"() {
|
|
321390
321428
|
"use strict";
|
|
321391
321429
|
__name(equalSets, "equalSets");
|
|
321430
|
+
__name(setDiff, "setDiff");
|
|
321392
321431
|
}
|
|
321393
321432
|
});
|
|
321394
321433
|
|
|
@@ -332767,6 +332806,9 @@ var init_cloudformation4 = __esm({
|
|
|
332767
332806
|
equalTo(other) {
|
|
332768
332807
|
return this.logicalResourceId === other.logicalResourceId && this.stack.stackName === other.stack.stackName;
|
|
332769
332808
|
}
|
|
332809
|
+
get stackName() {
|
|
332810
|
+
return this.stack.stackName;
|
|
332811
|
+
}
|
|
332770
332812
|
};
|
|
332771
332813
|
ResourceMapping = class {
|
|
332772
332814
|
constructor(source, destination) {
|
|
@@ -332785,6 +332827,18 @@ var init_cloudformation4 = __esm({
|
|
|
332785
332827
|
destinationPath: this.destination.toPath()
|
|
332786
332828
|
};
|
|
332787
332829
|
}
|
|
332830
|
+
toCloudFormation() {
|
|
332831
|
+
return {
|
|
332832
|
+
Source: {
|
|
332833
|
+
StackName: this.source.stack.stackName,
|
|
332834
|
+
LogicalResourceId: this.source.logicalResourceId
|
|
332835
|
+
},
|
|
332836
|
+
Destination: {
|
|
332837
|
+
StackName: this.destination.stack.stackName,
|
|
332838
|
+
LogicalResourceId: this.destination.logicalResourceId
|
|
332839
|
+
}
|
|
332840
|
+
};
|
|
332841
|
+
}
|
|
332788
332842
|
};
|
|
332789
332843
|
}
|
|
332790
332844
|
});
|
|
@@ -332834,15 +332888,17 @@ var init_graph = __esm({
|
|
|
332834
332888
|
}
|
|
332835
332889
|
if ("Fn::ImportValue" in value) {
|
|
332836
332890
|
const exp = exports2[value["Fn::ImportValue"]];
|
|
332837
|
-
|
|
332838
|
-
|
|
332839
|
-
|
|
332840
|
-
|
|
332841
|
-
|
|
332842
|
-
|
|
332843
|
-
|
|
332891
|
+
if (exp != null) {
|
|
332892
|
+
const v6 = exp.value;
|
|
332893
|
+
if ("Fn::GetAtt" in v6) {
|
|
332894
|
+
const id = Array.isArray(v6["Fn::GetAtt"]) ? v6["Fn::GetAtt"][0] : v6["Fn::GetAtt"].split(".")[0];
|
|
332895
|
+
return [`${exp.stackName}.${id}`];
|
|
332896
|
+
}
|
|
332897
|
+
if ("Ref" in v6) {
|
|
332898
|
+
return [`${exp.stackName}.${v6.Ref}`];
|
|
332899
|
+
}
|
|
332900
|
+
return [`${exp.stackName}.${v6}`];
|
|
332844
332901
|
}
|
|
332845
|
-
return [`${exp.stackName}.${v6}`];
|
|
332846
332902
|
}
|
|
332847
332903
|
const result2 = [];
|
|
332848
332904
|
if ("DependsOn" in value) {
|
|
@@ -332983,11 +333039,14 @@ function stripReferences(value, exports2) {
|
|
|
332983
333039
|
return { __cloud_ref__: "DependsOn" };
|
|
332984
333040
|
}
|
|
332985
333041
|
if ("Fn::ImportValue" in value) {
|
|
332986
|
-
const
|
|
332987
|
-
if (
|
|
332988
|
-
|
|
332989
|
-
|
|
332990
|
-
|
|
333042
|
+
const exp = exports2[value["Fn::ImportValue"]];
|
|
333043
|
+
if (exp != null) {
|
|
333044
|
+
const v6 = exp.value;
|
|
333045
|
+
if ("Ref" in v6) {
|
|
333046
|
+
return { __cloud_ref__: "Ref" };
|
|
333047
|
+
} else if ("Fn::GetAtt" in v6) {
|
|
333048
|
+
return { __cloud_ref__: "Fn::GetAtt" };
|
|
333049
|
+
}
|
|
332991
333050
|
}
|
|
332992
333051
|
}
|
|
332993
333052
|
const result2 = {};
|
|
@@ -333036,14 +333095,30 @@ function structuralOverrides(deployedStacks, localStacks) {
|
|
|
333036
333095
|
function resourceMoves(before, after, direction = "direct", ignoreModifications = false) {
|
|
333037
333096
|
const digestsBefore = resourceDigests(before, direction);
|
|
333038
333097
|
const digestsAfter = resourceDigests(after, direction);
|
|
333039
|
-
const stackNames = /* @__PURE__ */ __name((stacks) => stacks.map((s3) => s3.stackName).sort().join(", "), "stackNames");
|
|
333040
333098
|
if (!(ignoreModifications || isomorphic(digestsBefore, digestsAfter))) {
|
|
333041
|
-
const message2 = [
|
|
333042
|
-
|
|
333043
|
-
|
|
333044
|
-
|
|
333045
|
-
|
|
333046
|
-
|
|
333099
|
+
const message2 = ["A refactor operation cannot add, remove or update resources. Only resource moves and renames are allowed."];
|
|
333100
|
+
const difference2 = /* @__PURE__ */ __name((a3, b3) => {
|
|
333101
|
+
return Array.from(setDiff(new Set(Object.keys(a3)), new Set(Object.keys(b3)))).flatMap((k3) => a3[k3]).map((x3) => ` - ${x3.toPath()}`).sort().join("\n");
|
|
333102
|
+
}, "difference");
|
|
333103
|
+
const stackNames = /* @__PURE__ */ __name((stacks) => stacks.length === 0 ? "NONE" : stacks.map((s3) => s3.stackName).sort().join(", "), "stackNames");
|
|
333104
|
+
const onlyDeployed = difference2(digestsBefore, digestsAfter);
|
|
333105
|
+
const onlyLocal = difference2(digestsAfter, digestsBefore);
|
|
333106
|
+
if (onlyDeployed.length > 0) {
|
|
333107
|
+
message2.push(`The following resources are present only in the AWS environment:
|
|
333108
|
+
${onlyDeployed}`);
|
|
333109
|
+
}
|
|
333110
|
+
if (onlyLocal.length > 0) {
|
|
333111
|
+
message2.push(`
|
|
333112
|
+
The following resources are present only in your CDK application:
|
|
333113
|
+
${onlyLocal}`);
|
|
333114
|
+
}
|
|
333115
|
+
message2.push("");
|
|
333116
|
+
message2.push("The following stacks were used in the comparison:");
|
|
333117
|
+
message2.push(` - Deployed: ${stackNames(before)}`);
|
|
333118
|
+
message2.push(` - Local: ${stackNames(after)}`);
|
|
333119
|
+
message2.push("");
|
|
333120
|
+
message2.push("Hint: by default, only deployed stacks that have the same name as a local stack are included.");
|
|
333121
|
+
message2.push("If you want to include additional deployed stacks for comparison, re-run the command with the option '--additional-stack-name=<STACK>' for each stack.");
|
|
333047
333122
|
throw new ToolkitError(message2.join("\n"));
|
|
333048
333123
|
}
|
|
333049
333124
|
return Object.values(removeUnmovedResources(zip(digestsBefore, digestsAfter)));
|
|
@@ -333150,20 +333225,49 @@ function partitionByAmbiguity(overrides, moves) {
|
|
|
333150
333225
|
__name(remove2, "remove");
|
|
333151
333226
|
return [nonAmbiguous, ambiguous];
|
|
333152
333227
|
}
|
|
333153
|
-
|
|
333228
|
+
async function replaceAwsPlaceholders2(object, aws) {
|
|
333229
|
+
let partition3 = /* @__PURE__ */ __name(async () => {
|
|
333230
|
+
const p3 = await aws.discoverPartition();
|
|
333231
|
+
partition3 = /* @__PURE__ */ __name(() => Promise.resolve(p3), "partition");
|
|
333232
|
+
return p3;
|
|
333233
|
+
}, "partition");
|
|
333234
|
+
let account = /* @__PURE__ */ __name(async () => {
|
|
333235
|
+
const a3 = await aws.discoverCurrentAccount();
|
|
333236
|
+
account = /* @__PURE__ */ __name(() => Promise.resolve(a3), "account");
|
|
333237
|
+
return a3;
|
|
333238
|
+
}, "account");
|
|
333239
|
+
return import_cx_api11.EnvironmentPlaceholders.replaceAsync(object, {
|
|
333240
|
+
async region() {
|
|
333241
|
+
return object.region ?? aws.discoverDefaultRegion();
|
|
333242
|
+
},
|
|
333243
|
+
async accountId() {
|
|
333244
|
+
return (await account()).accountId;
|
|
333245
|
+
},
|
|
333246
|
+
async partition() {
|
|
333247
|
+
return partition3();
|
|
333248
|
+
}
|
|
333249
|
+
});
|
|
333250
|
+
}
|
|
333251
|
+
var import_cdk_assets_lib5, import_cx_api11, RefactoringContext;
|
|
333154
333252
|
var init_context3 = __esm({
|
|
333155
333253
|
"../@aws-cdk/toolkit-lib/lib/api/refactoring/context.ts"() {
|
|
333156
333254
|
"use strict";
|
|
333255
|
+
import_cdk_assets_lib5 = __toESM(require_lib6());
|
|
333256
|
+
import_cx_api11 = __toESM(require_lib3());
|
|
333157
333257
|
init_cloudformation4();
|
|
333158
333258
|
init_digest();
|
|
333159
333259
|
init_toolkit_error();
|
|
333160
333260
|
init_sets();
|
|
333261
|
+
init_environment();
|
|
333262
|
+
init_plugin2();
|
|
333161
333263
|
RefactoringContext = class {
|
|
333162
333264
|
static {
|
|
333163
333265
|
__name(this, "RefactoringContext");
|
|
333164
333266
|
}
|
|
333165
333267
|
_mappings = [];
|
|
333166
333268
|
ambiguousMoves = [];
|
|
333269
|
+
localStacks;
|
|
333270
|
+
assumeRoleArn;
|
|
333167
333271
|
environment;
|
|
333168
333272
|
constructor(props) {
|
|
333169
333273
|
this.environment = props.environment;
|
|
@@ -333172,6 +333276,8 @@ var init_context3 = __esm({
|
|
|
333172
333276
|
const overrides = (props.overrides ?? []).concat(additionalOverrides);
|
|
333173
333277
|
const [nonAmbiguousMoves, ambiguousMoves] = partitionByAmbiguity(overrides, moves);
|
|
333174
333278
|
this.ambiguousMoves = ambiguousMoves;
|
|
333279
|
+
this.localStacks = props.localStacks;
|
|
333280
|
+
this.assumeRoleArn = props.assumeRoleArn;
|
|
333175
333281
|
this._mappings = resourceMappings(nonAmbiguousMoves);
|
|
333176
333282
|
}
|
|
333177
333283
|
get ambiguousPaths() {
|
|
@@ -333184,6 +333290,68 @@ var init_context3 = __esm({
|
|
|
333184
333290
|
get mappings() {
|
|
333185
333291
|
return this._mappings;
|
|
333186
333292
|
}
|
|
333293
|
+
async execute(stackDefinitions, sdkProvider, ioHelper) {
|
|
333294
|
+
if (this.mappings.length === 0) {
|
|
333295
|
+
return;
|
|
333296
|
+
}
|
|
333297
|
+
const assumeRoleArn = this.assumeRoleArn ?? await this.findRoleToAssume(sdkProvider);
|
|
333298
|
+
const sdk = (await sdkProvider.forEnvironment(this.environment, 1 /* ForWriting */, {
|
|
333299
|
+
assumeRoleArn
|
|
333300
|
+
})).sdk;
|
|
333301
|
+
await this.checkBootstrapVersion(sdk, ioHelper);
|
|
333302
|
+
const cfn = sdk.cloudFormation();
|
|
333303
|
+
const mappings = this.mappings;
|
|
333304
|
+
const input = {
|
|
333305
|
+
ResourceMappings: mappings.map((m3) => m3.toCloudFormation()),
|
|
333306
|
+
StackDefinitions: stackDefinitions
|
|
333307
|
+
};
|
|
333308
|
+
const refactor = await cfn.createStackRefactor(input);
|
|
333309
|
+
await cfn.waitUntilStackRefactorCreateComplete({
|
|
333310
|
+
StackRefactorId: refactor.StackRefactorId
|
|
333311
|
+
});
|
|
333312
|
+
await cfn.executeStackRefactor({
|
|
333313
|
+
StackRefactorId: refactor.StackRefactorId
|
|
333314
|
+
});
|
|
333315
|
+
await cfn.waitUntilStackRefactorExecuteComplete({
|
|
333316
|
+
StackRefactorId: refactor.StackRefactorId
|
|
333317
|
+
});
|
|
333318
|
+
}
|
|
333319
|
+
async checkBootstrapVersion(sdk, ioHelper) {
|
|
333320
|
+
const environmentResourcesRegistry = new EnvironmentResourcesRegistry();
|
|
333321
|
+
const envResources = environmentResourcesRegistry.for(this.environment, sdk, ioHelper);
|
|
333322
|
+
let bootstrapVersion = void 0;
|
|
333323
|
+
try {
|
|
333324
|
+
bootstrapVersion = (await envResources.lookupToolkit()).version;
|
|
333325
|
+
} catch (e3) {
|
|
333326
|
+
}
|
|
333327
|
+
if (bootstrapVersion != null && bootstrapVersion < 28) {
|
|
333328
|
+
const environment = `aws://${this.environment.account}/${this.environment.region}`;
|
|
333329
|
+
throw new ToolkitError(
|
|
333330
|
+
`The CDK toolkit stack in environment ${environment} doesn't support refactoring. Please run 'cdk bootstrap ${environment}' to update it.`
|
|
333331
|
+
);
|
|
333332
|
+
}
|
|
333333
|
+
}
|
|
333334
|
+
async findRoleToAssume(sdkProvider) {
|
|
333335
|
+
const env2 = this.environment;
|
|
333336
|
+
const roleArns = new Set(
|
|
333337
|
+
this.localStacks.filter((s3) => s3.environment.account === env2.account && s3.environment.region === env2.region).map((s3) => s3.assumeRoleArn)
|
|
333338
|
+
);
|
|
333339
|
+
if (roleArns.size === 0) {
|
|
333340
|
+
return void 0;
|
|
333341
|
+
}
|
|
333342
|
+
if (roleArns.size !== 1) {
|
|
333343
|
+
throw new ToolkitError(
|
|
333344
|
+
`Multiple stacks in environment aws://${env2.account}/${env2.region} have different deployment role ARNs. Cannot proceed.`
|
|
333345
|
+
);
|
|
333346
|
+
}
|
|
333347
|
+
const arn = Array.from(roleArns)[0];
|
|
333348
|
+
if (arn != null) {
|
|
333349
|
+
const resolvedEnv = await sdkProvider.resolveEnvironment(env2);
|
|
333350
|
+
const region = resolvedEnv.region;
|
|
333351
|
+
return (await replaceAwsPlaceholders2({ region, assumeRoleArn: arn }, new import_cdk_assets_lib5.DefaultAwsClient())).assumeRoleArn;
|
|
333352
|
+
}
|
|
333353
|
+
return void 0;
|
|
333354
|
+
}
|
|
333187
333355
|
};
|
|
333188
333356
|
__name(structuralOverrides, "structuralOverrides");
|
|
333189
333357
|
__name(resourceMoves, "resourceMoves");
|
|
@@ -333194,6 +333362,7 @@ var init_context3 = __esm({
|
|
|
333194
333362
|
__name(isAmbiguousMove, "isAmbiguousMove");
|
|
333195
333363
|
__name(resourceMappings, "resourceMappings");
|
|
333196
333364
|
__name(partitionByAmbiguity, "partitionByAmbiguity");
|
|
333365
|
+
__name(replaceAwsPlaceholders2, "replaceAwsPlaceholders");
|
|
333197
333366
|
}
|
|
333198
333367
|
});
|
|
333199
333368
|
|
|
@@ -333783,6 +333952,59 @@ var init_drift3 = __esm({
|
|
|
333783
333952
|
}
|
|
333784
333953
|
});
|
|
333785
333954
|
|
|
333955
|
+
// ../@aws-cdk/toolkit-lib/lib/api/refactoring/stack-definitions.ts
|
|
333956
|
+
function generateStackDefinitions(mappings, deployedStacks, localStacks) {
|
|
333957
|
+
const deployedStackMap = new Map(deployedStacks.map((s3) => [s3.stackName, s3]));
|
|
333958
|
+
for (const localStack of localStacks) {
|
|
333959
|
+
const deployedStack = deployedStackMap.get(localStack.stackName);
|
|
333960
|
+
const localTemplate = localStack.template;
|
|
333961
|
+
const deployedTemplate = deployedStack?.template;
|
|
333962
|
+
if (deployedTemplate?.Resources?.CDKMetadata != null) {
|
|
333963
|
+
localTemplate.Resources = localTemplate.Resources ?? {};
|
|
333964
|
+
localTemplate.Resources.CDKMetadata = deployedTemplate.Resources.CDKMetadata;
|
|
333965
|
+
} else {
|
|
333966
|
+
delete localTemplate.Resources?.CDKMetadata;
|
|
333967
|
+
}
|
|
333968
|
+
}
|
|
333969
|
+
const stacksToProcess = localStacks.filter((localStack) => {
|
|
333970
|
+
const deployedStack = deployedStackMap.get(localStack.stackName);
|
|
333971
|
+
return !deployedStack || !deepEqual4(localStack.template, deployedStack.template);
|
|
333972
|
+
});
|
|
333973
|
+
for (let mapping of mappings) {
|
|
333974
|
+
const stackName = mapping.source.stackName;
|
|
333975
|
+
if (!localStacks.some((s3) => s3.stackName === stackName)) {
|
|
333976
|
+
const deployedStack = deployedStackMap.get(stackName);
|
|
333977
|
+
delete deployedStack?.template.Resources?.[mapping.source.logicalResourceId];
|
|
333978
|
+
delete deployedStack?.template.Outputs;
|
|
333979
|
+
if (deployedStack && !stacksToProcess.some((s3) => s3.stackName === stackName)) {
|
|
333980
|
+
stacksToProcess.push(deployedStack);
|
|
333981
|
+
}
|
|
333982
|
+
}
|
|
333983
|
+
}
|
|
333984
|
+
for (const stack of stacksToProcess) {
|
|
333985
|
+
if (!deployedStacks.some((deployed) => deployed.stackName === stack.stackName)) {
|
|
333986
|
+
if ("Rules" in stack.template) {
|
|
333987
|
+
delete stack.template.Rules;
|
|
333988
|
+
}
|
|
333989
|
+
if ("Parameters" in stack.template) {
|
|
333990
|
+
delete stack.template.Parameters;
|
|
333991
|
+
}
|
|
333992
|
+
}
|
|
333993
|
+
}
|
|
333994
|
+
return stacksToProcess.map((stack) => ({
|
|
333995
|
+
StackName: stack.stackName,
|
|
333996
|
+
TemplateBody: JSON.stringify(stack.template)
|
|
333997
|
+
}));
|
|
333998
|
+
}
|
|
333999
|
+
var deepEqual4;
|
|
334000
|
+
var init_stack_definitions = __esm({
|
|
334001
|
+
"../@aws-cdk/toolkit-lib/lib/api/refactoring/stack-definitions.ts"() {
|
|
334002
|
+
"use strict";
|
|
334003
|
+
deepEqual4 = require_fast_deep_equal();
|
|
334004
|
+
__name(generateStackDefinitions, "generateStackDefinitions");
|
|
334005
|
+
}
|
|
334006
|
+
});
|
|
334007
|
+
|
|
333786
334008
|
// ../@aws-cdk/toolkit-lib/lib/api/tags/private/util.ts
|
|
333787
334009
|
function tagsForStack(stack) {
|
|
333788
334010
|
return Object.entries(stack.tags).map(([Key, Value]) => ({ Key, Value }));
|
|
@@ -333864,6 +334086,7 @@ var init_toolkit = __esm({
|
|
|
333864
334086
|
init_refactoring();
|
|
333865
334087
|
init_cloudformation4();
|
|
333866
334088
|
init_context3();
|
|
334089
|
+
init_stack_definitions();
|
|
333867
334090
|
init_resource_import();
|
|
333868
334091
|
init_private9();
|
|
333869
334092
|
init_toolkit_info();
|
|
@@ -334646,7 +334869,7 @@ ${deployResult.stackArn}`));
|
|
|
334646
334869
|
this.requireUnstableFeature("refactor");
|
|
334647
334870
|
const ioHelper = asIoHelper(this.ioHost, "refactor");
|
|
334648
334871
|
const assembly = __using(_stack, await assemblyFromSource(ioHelper, cx), true);
|
|
334649
|
-
return await this._refactor(assembly, ioHelper, options);
|
|
334872
|
+
return await this._refactor(assembly, ioHelper, cx, options);
|
|
334650
334873
|
} catch (_3) {
|
|
334651
334874
|
var _error = _3, _hasError = true;
|
|
334652
334875
|
} finally {
|
|
@@ -334654,20 +334877,27 @@ ${deployResult.stackArn}`));
|
|
|
334654
334877
|
_promise && await _promise;
|
|
334655
334878
|
}
|
|
334656
334879
|
}
|
|
334657
|
-
async _refactor(assembly, ioHelper, options = {}) {
|
|
334658
|
-
if (!options.dryRun) {
|
|
334659
|
-
throw new ToolkitError("Refactor is not available yet. Too see the proposed changes, use the --dry-run flag.");
|
|
334660
|
-
}
|
|
334880
|
+
async _refactor(assembly, ioHelper, cx, options = {}) {
|
|
334661
334881
|
const sdkProvider = await this.sdkProvider("refactor");
|
|
334662
334882
|
const selectedStacks = await assembly.selectStacksV2(options.stacks ?? ALL_STACKS);
|
|
334663
334883
|
const groups = await groupStacks(sdkProvider, selectedStacks.stackArtifacts, options.additionalStackNames ?? []);
|
|
334664
334884
|
for (let { environment, localStacks, deployedStacks } of groups) {
|
|
334665
334885
|
await ioHelper.defaults.info(formatEnvironmentSectionHeader2(environment));
|
|
334886
|
+
const newStacks = localStacks.filter((s3) => !deployedStacks.map((t3) => t3.stackName).includes(s3.stackName));
|
|
334887
|
+
if (newStacks.length > 0) {
|
|
334888
|
+
let message2 = `The following stack${newStacks.length === 1 ? " is" : "s are"} new: ${newStacks.map((s3) => s3.stackName).join(", ")}
|
|
334889
|
+
`;
|
|
334890
|
+
message2 += "Creation of new stacks is not yet supported by the refactor command. ";
|
|
334891
|
+
message2 += "Please deploy any new stacks separately before refactoring your stacks.";
|
|
334892
|
+
await ioHelper.defaults.error(chalk23.red(message2));
|
|
334893
|
+
continue;
|
|
334894
|
+
}
|
|
334666
334895
|
try {
|
|
334667
334896
|
const context = new RefactoringContext({
|
|
334668
334897
|
environment,
|
|
334669
334898
|
deployedStacks,
|
|
334670
334899
|
localStacks,
|
|
334900
|
+
assumeRoleArn: options.roleArn,
|
|
334671
334901
|
overrides: getOverrides(environment, deployedStacks, localStacks)
|
|
334672
334902
|
});
|
|
334673
334903
|
const mappings = context.mappings;
|
|
@@ -334678,48 +334908,85 @@ ${deployResult.stackArn}`));
|
|
|
334678
334908
|
const typedMappings = mappings.map((m3) => m3.toTypedMapping()).filter((m3) => m3.type !== "AWS::CDK::Metadata");
|
|
334679
334909
|
let refactorMessage = formatTypedMappings2(typedMappings);
|
|
334680
334910
|
const refactorResult = { typedMappings };
|
|
334911
|
+
const stackDefinitions = generateStackDefinitions(mappings, deployedStacks, localStacks);
|
|
334681
334912
|
if (context.ambiguousPaths.length > 0) {
|
|
334682
334913
|
const paths = context.ambiguousPaths;
|
|
334683
334914
|
refactorMessage += "\n" + formatAmbiguousMappings2(paths);
|
|
334684
334915
|
refactorResult.ambiguousPaths = paths;
|
|
334685
334916
|
}
|
|
334686
334917
|
await ioHelper.notify(IO.CDK_TOOLKIT_I8900.msg(refactorMessage, refactorResult));
|
|
334918
|
+
if (options.dryRun || context.mappings.length === 0 || context.ambiguousPaths.length > 0) {
|
|
334919
|
+
continue;
|
|
334920
|
+
}
|
|
334921
|
+
if (process.stdout.isTTY && !await confirm4(options.force ?? false)) {
|
|
334922
|
+
await ioHelper.defaults.info(chalk23.red(`Refactoring canceled for environment aws://${environment.account}/${environment.region}
|
|
334923
|
+
`));
|
|
334924
|
+
continue;
|
|
334925
|
+
}
|
|
334926
|
+
await ioHelper.defaults.info("Refactoring...");
|
|
334927
|
+
await context.execute(stackDefinitions, sdkProvider, ioHelper);
|
|
334928
|
+
await ioHelper.defaults.info("\u2705 Stack refactor complete");
|
|
334929
|
+
await ioHelper.defaults.info("Deploying updated stacks to finalize refactor...");
|
|
334930
|
+
await this.deploy(cx, {
|
|
334931
|
+
stacks: ALL_STACKS,
|
|
334932
|
+
forceDeployment: true
|
|
334933
|
+
});
|
|
334687
334934
|
} catch (e3) {
|
|
334688
|
-
|
|
334935
|
+
const message2 = `\u274C Refactor failed: ${formatError(e3)}`;
|
|
334936
|
+
await ioHelper.notify(IO.CDK_TOOLKIT_E8900.msg(message2, { error: e3 }));
|
|
334937
|
+
await ioHelper.defaults.debug(e3.message);
|
|
334689
334938
|
}
|
|
334690
334939
|
}
|
|
334691
334940
|
function getOverrides(environment, deployedStacks, localStacks) {
|
|
334692
334941
|
const mappingGroup = options.overrides?.find((g3) => g3.region === environment.region && g3.account === environment.account);
|
|
334693
|
-
|
|
334694
|
-
|
|
334695
|
-
|
|
334696
|
-
|
|
334697
|
-
|
|
334698
|
-
|
|
334699
|
-
|
|
334700
|
-
|
|
334701
|
-
|
|
334702
|
-
|
|
334703
|
-
);
|
|
334704
|
-
}
|
|
334705
|
-
|
|
334706
|
-
|
|
334707
|
-
|
|
334708
|
-
const result2 = stacks.find((stack) => {
|
|
334709
|
-
const [stackName, logicalId] = location.split(".");
|
|
334710
|
-
if (stackName == null || logicalId == null) {
|
|
334711
|
-
throw new ToolkitError(`Invalid location '${location}'`);
|
|
334942
|
+
return mappingGroup == null ? [] : Object.entries(mappingGroup.resources ?? {}).map(([source, destination]) => new ResourceMapping(
|
|
334943
|
+
getResourceLocation(source, deployedStacks),
|
|
334944
|
+
getResourceLocation(destination, localStacks)
|
|
334945
|
+
));
|
|
334946
|
+
}
|
|
334947
|
+
__name(getOverrides, "getOverrides");
|
|
334948
|
+
function getResourceLocation(location, stacks) {
|
|
334949
|
+
for (let stack of stacks) {
|
|
334950
|
+
const [stackName, logicalId] = location.split(".");
|
|
334951
|
+
if (stackName != null && logicalId != null && stack.stackName === stackName && stack.template.Resources?.[logicalId] != null) {
|
|
334952
|
+
return new ResourceLocation(stack, logicalId);
|
|
334953
|
+
} else {
|
|
334954
|
+
const resourceEntry = Object.entries(stack.template.Resources ?? {}).find(([_3, r3]) => r3.Metadata?.["aws:cdk:path"] === location);
|
|
334955
|
+
if (resourceEntry != null) {
|
|
334956
|
+
return new ResourceLocation(stack, resourceEntry[0]);
|
|
334712
334957
|
}
|
|
334713
|
-
return stack.stackName === stackName && stack.template.Resources?.[logicalId] != null;
|
|
334714
|
-
});
|
|
334715
|
-
if (result2 == null) {
|
|
334716
|
-
throw new ToolkitError(`Cannot find resource in location ${location}`);
|
|
334717
334958
|
}
|
|
334718
|
-
return result2;
|
|
334719
334959
|
}
|
|
334720
|
-
|
|
334960
|
+
throw new ToolkitError(`Cannot find resource in location ${location}`);
|
|
334721
334961
|
}
|
|
334722
|
-
__name(
|
|
334962
|
+
__name(getResourceLocation, "getResourceLocation");
|
|
334963
|
+
async function confirm4(force) {
|
|
334964
|
+
if (force) {
|
|
334965
|
+
return true;
|
|
334966
|
+
}
|
|
334967
|
+
const question2 = "Do you wish to refactor these resources?";
|
|
334968
|
+
const response = await ioHelper.requestResponse(IO.CDK_TOOLKIT_I8910.req(question2, {
|
|
334969
|
+
responseDescription: "[Y]es/[n]o"
|
|
334970
|
+
}, "y"));
|
|
334971
|
+
return ["y", "yes"].includes(response.toLowerCase());
|
|
334972
|
+
}
|
|
334973
|
+
__name(confirm4, "confirm");
|
|
334974
|
+
function formatError(error5) {
|
|
334975
|
+
try {
|
|
334976
|
+
const payload2 = JSON.parse(error5.message);
|
|
334977
|
+
const messages = [];
|
|
334978
|
+
if (payload2.reason?.StatusReason) {
|
|
334979
|
+
messages.push(`Refactor creation: [${payload2.reason?.Status}] ${payload2.reason.StatusReason}`);
|
|
334980
|
+
}
|
|
334981
|
+
if (payload2.reason?.ExecutionStatusReason) {
|
|
334982
|
+
messages.push(`Refactor execution: [${payload2.reason?.Status}] ${payload2.reason.ExecutionStatusReason}`);
|
|
334983
|
+
}
|
|
334984
|
+
return messages.length > 0 ? messages.join("\n") : `Unknown error (Stack refactor ID: ${payload2.reason?.StackRefactorId ?? "unknown"})`;
|
|
334985
|
+
} catch (e3) {
|
|
334986
|
+
return formatErrorMessage(error5);
|
|
334987
|
+
}
|
|
334988
|
+
}
|
|
334989
|
+
__name(formatError, "formatError");
|
|
334723
334990
|
}
|
|
334724
334991
|
/**
|
|
334725
334992
|
* Destroy Action
|
|
@@ -338476,6 +338743,11 @@ var require_cli_type_registry = __commonJS({
|
|
|
338476
338743
|
type: "boolean",
|
|
338477
338744
|
default: false,
|
|
338478
338745
|
desc: "If specified, the command will revert the refactor operation. This is only valid if a mapping file was provided."
|
|
338746
|
+
},
|
|
338747
|
+
force: {
|
|
338748
|
+
type: "boolean",
|
|
338749
|
+
default: false,
|
|
338750
|
+
desc: "Whether to do the refactor without asking for confirmation"
|
|
338479
338751
|
}
|
|
338480
338752
|
}
|
|
338481
338753
|
},
|
|
@@ -342655,8 +342927,8 @@ function chunks(list2, chunkSize) {
|
|
|
342655
342927
|
}
|
|
342656
342928
|
function setEnvironment(account, region) {
|
|
342657
342929
|
return {
|
|
342658
|
-
account: account ??
|
|
342659
|
-
region: region ??
|
|
342930
|
+
account: account ?? import_cx_api12.UNKNOWN_ACCOUNT,
|
|
342931
|
+
region: region ?? import_cx_api12.UNKNOWN_REGION,
|
|
342660
342932
|
name: "cdk-migrate-env"
|
|
342661
342933
|
};
|
|
342662
342934
|
}
|
|
@@ -342839,13 +343111,13 @@ function deduplicateResources(resources) {
|
|
|
342839
343111
|
}
|
|
342840
343112
|
return Object.values(uniqueResources);
|
|
342841
343113
|
}
|
|
342842
|
-
var fs36, path34,
|
|
343114
|
+
var fs36, path34, import_cx_api12, import_toolkit_lib13, cdk_from_cfn, chalk27, camelCase2, decamelize2, MIGRATE_SUPPORTED_LANGUAGES, FilterType, CfnTemplateGeneratorProvider;
|
|
342843
343115
|
var init_migrate = __esm({
|
|
342844
343116
|
"lib/commands/migrate.ts"() {
|
|
342845
343117
|
"use strict";
|
|
342846
343118
|
fs36 = __toESM(require("fs"));
|
|
342847
343119
|
path34 = __toESM(require("path"));
|
|
342848
|
-
|
|
343120
|
+
import_cx_api12 = __toESM(require_lib3());
|
|
342849
343121
|
import_toolkit_lib13 = __toESM(require_lib12());
|
|
342850
343122
|
cdk_from_cfn = __toESM(require_cdk_from_cfn());
|
|
342851
343123
|
chalk27 = __toESM(require_source());
|
|
@@ -344099,8 +344371,10 @@ var init_cdk_toolkit = __esm({
|
|
|
344099
344371
|
patterns,
|
|
344100
344372
|
strategy: patterns.length > 0 ? "pattern-match" /* PATTERN_MATCH */ : "all-stacks" /* ALL_STACKS */
|
|
344101
344373
|
},
|
|
344374
|
+
force: options.force,
|
|
344102
344375
|
additionalStackNames: options.additionalStackNames,
|
|
344103
|
-
overrides: readOverrides(options.overrideFile, options.revert)
|
|
344376
|
+
overrides: readOverrides(options.overrideFile, options.revert),
|
|
344377
|
+
roleArn: options.roleArn
|
|
344104
344378
|
});
|
|
344105
344379
|
} catch (e3) {
|
|
344106
344380
|
await this.ioHost.asIoHelper().defaults.error(e3.message);
|
|
@@ -344432,20 +344706,14 @@ function browserForPlatform() {
|
|
|
344432
344706
|
return "xdg-open %u";
|
|
344433
344707
|
}
|
|
344434
344708
|
}
|
|
344435
|
-
function shouldDisplayNotices() {
|
|
344436
|
-
return !isCI2() || Boolean(ciSystemIsStdErrSafe());
|
|
344437
|
-
}
|
|
344438
344709
|
var init_yargs_helpers = __esm({
|
|
344439
344710
|
"lib/cli/util/yargs-helpers.ts"() {
|
|
344440
344711
|
"use strict";
|
|
344441
|
-
init_ci_systems();
|
|
344442
|
-
init_ci();
|
|
344443
344712
|
init_version2();
|
|
344444
344713
|
init_ci();
|
|
344445
344714
|
__name(yargsNegativeAlias, "yargsNegativeAlias");
|
|
344446
344715
|
__name(cliVersion, "cliVersion");
|
|
344447
344716
|
__name(browserForPlatform, "browserForPlatform");
|
|
344448
|
-
__name(shouldDisplayNotices, "shouldDisplayNotices");
|
|
344449
344717
|
}
|
|
344450
344718
|
});
|
|
344451
344719
|
|
|
@@ -349315,7 +349583,7 @@ function parseCommandLineArguments(args) {
|
|
|
349315
349583
|
desc: "Emits the synthesized cloud assembly into a directory (default: cdk.out)",
|
|
349316
349584
|
requiresArg: true
|
|
349317
349585
|
}).option("notices", {
|
|
349318
|
-
default:
|
|
349586
|
+
default: void 0,
|
|
349319
349587
|
type: "boolean",
|
|
349320
349588
|
desc: "Show relevant notices"
|
|
349321
349589
|
}).option("no-color", {
|
|
@@ -350040,6 +350308,10 @@ function parseCommandLineArguments(args) {
|
|
|
350040
350308
|
default: false,
|
|
350041
350309
|
type: "boolean",
|
|
350042
350310
|
desc: "If specified, the command will revert the refactor operation. This is only valid if a mapping file was provided."
|
|
350311
|
+
}).option("force", {
|
|
350312
|
+
default: false,
|
|
350313
|
+
type: "boolean",
|
|
350314
|
+
desc: "Whether to do the refactor without asking for confirmation"
|
|
350043
350315
|
})
|
|
350044
350316
|
).command(
|
|
350045
350317
|
"cli-telemetry",
|
|
@@ -355140,7 +355412,7 @@ async function handleFlags(flagData, ioHelper, options, toolkit) {
|
|
|
355140
355412
|
return;
|
|
355141
355413
|
}
|
|
355142
355414
|
if (options.unconfigured && options.FLAGNAME) {
|
|
355143
|
-
await ioHelper.defaults.error("Error: Cannot use --unconfigured with a specific flag name. --unconfigured works
|
|
355415
|
+
await ioHelper.defaults.error("Error: Cannot use --unconfigured with a specific flag name. --unconfigured works with multiple flags.");
|
|
355144
355416
|
return;
|
|
355145
355417
|
}
|
|
355146
355418
|
if (options.set && options.FLAGNAME && !options.value) {
|
|
@@ -355155,6 +355427,10 @@ async function handleFlags(flagData, ioHelper, options, toolkit) {
|
|
|
355155
355427
|
await ioHelper.defaults.error("Error: When using --set with --unconfigured, you must specify either --recommended or --default.");
|
|
355156
355428
|
return;
|
|
355157
355429
|
}
|
|
355430
|
+
if (options.set && !options.all && !options.unconfigured && !options.FLAGNAME) {
|
|
355431
|
+
await ioHelper.defaults.error("Error: When using --set, you must specify either --all, --unconfigured, or provide a specific flag name.");
|
|
355432
|
+
return;
|
|
355433
|
+
}
|
|
355158
355434
|
if (options.FLAGNAME && !options.set && !options.value) {
|
|
355159
355435
|
await displayFlags(params);
|
|
355160
355436
|
return;
|
|
@@ -383315,8 +383591,19 @@ async function exec4(args, synthesizer) {
|
|
|
383315
383591
|
} catch (e3) {
|
|
383316
383592
|
await ioHost.asIoHelper().defaults.trace(`Telemetry instantiation failed: ${e3.message}`);
|
|
383317
383593
|
}
|
|
383318
|
-
const
|
|
383319
|
-
|
|
383594
|
+
const isSafeToWriteNotices = !isCI2() || Boolean(ciSystemIsStdErrSafe());
|
|
383595
|
+
let shouldDisplayNotices;
|
|
383596
|
+
if (argv.notices !== void 0) {
|
|
383597
|
+
shouldDisplayNotices = argv.notices;
|
|
383598
|
+
} else {
|
|
383599
|
+
const configNotices = configuration.settings.get(["notices"]);
|
|
383600
|
+
if (configNotices !== void 0) {
|
|
383601
|
+
shouldDisplayNotices = configNotices !== "false" && Boolean(configNotices);
|
|
383602
|
+
} else {
|
|
383603
|
+
shouldDisplayNotices = isSafeToWriteNotices;
|
|
383604
|
+
}
|
|
383605
|
+
}
|
|
383606
|
+
ioHost.noticesDestination = shouldDisplayNotices ? "stderr" : "drop";
|
|
383320
383607
|
const notices = Notices.create({
|
|
383321
383608
|
ioHost,
|
|
383322
383609
|
context: configuration.context,
|
|
@@ -383325,7 +383612,7 @@ async function exec4(args, synthesizer) {
|
|
|
383325
383612
|
cliVersion: versionNumber2()
|
|
383326
383613
|
});
|
|
383327
383614
|
const refreshNotices = (async () => {
|
|
383328
|
-
if (
|
|
383615
|
+
if (shouldDisplayNotices && cmd !== "notices") {
|
|
383329
383616
|
try {
|
|
383330
383617
|
return await notices.refresh();
|
|
383331
383618
|
} catch (e3) {
|
|
@@ -383381,7 +383668,7 @@ async function exec4(args, synthesizer) {
|
|
|
383381
383668
|
includeAcknowledged: !argv.unacknowledged,
|
|
383382
383669
|
showTotal: argv.unacknowledged
|
|
383383
383670
|
});
|
|
383384
|
-
} else if (cmd !== "version") {
|
|
383671
|
+
} else if (shouldDisplayNotices && cmd !== "version") {
|
|
383385
383672
|
await notices.display();
|
|
383386
383673
|
}
|
|
383387
383674
|
}
|
|
@@ -383479,7 +383766,9 @@ async function exec4(args, synthesizer) {
|
|
|
383479
383766
|
overrideFile: args2.overrideFile,
|
|
383480
383767
|
revert: args2.revert,
|
|
383481
383768
|
stacks: selector,
|
|
383482
|
-
additionalStackNames: arrayFromYargs(args2.additionalStackName ?? [])
|
|
383769
|
+
additionalStackNames: arrayFromYargs(args2.additionalStackName ?? []),
|
|
383770
|
+
force: args2.force ?? false,
|
|
383771
|
+
roleArn: args2.roleArn
|
|
383483
383772
|
});
|
|
383484
383773
|
case "bootstrap":
|
|
383485
383774
|
ioHost.currentAction = "bootstrap";
|
|
@@ -383826,6 +384115,7 @@ var init_cli = __esm({
|
|
|
383826
384115
|
import_toolkit_lib19 = __toESM(require_lib12());
|
|
383827
384116
|
chalk35 = __toESM(require_source());
|
|
383828
384117
|
init_cdk_toolkit();
|
|
384118
|
+
init_ci_systems();
|
|
383829
384119
|
init_display_version();
|
|
383830
384120
|
init_io_host2();
|
|
383831
384121
|
init_parse_command_line_arguments();
|
|
@@ -383848,6 +384138,7 @@ var init_cli = __esm({
|
|
|
383848
384138
|
init_cxapp();
|
|
383849
384139
|
init_proxy_agent();
|
|
383850
384140
|
init_error();
|
|
384141
|
+
init_ci();
|
|
383851
384142
|
init_version2();
|
|
383852
384143
|
init_language();
|
|
383853
384144
|
if (!process.stdout.isTTY) {
|