@go-to-k/cdkd 0.46.0 → 0.46.1
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/dist/cli.js +92 -9
- package/dist/cli.js.map +2 -2
- package/dist/go-to-k-cdkd-0.46.1.tgz +0 -0
- package/dist/index.js +12 -0
- package/dist/index.js.map +2 -2
- package/package.json +1 -1
- package/dist/go-to-k-cdkd-0.46.0.tgz +0 -0
package/dist/cli.js
CHANGED
|
@@ -9175,6 +9175,18 @@ var IAMRoleProvider = class {
|
|
|
9175
9175
|
}
|
|
9176
9176
|
return result;
|
|
9177
9177
|
}
|
|
9178
|
+
/**
|
|
9179
|
+
* `Policies` (inline policy bodies) are intentionally omitted from
|
|
9180
|
+
* `readCurrentState`: surfacing the names without bodies would
|
|
9181
|
+
* guarantee a `PolicyDocument`-shaped drift on every role, and
|
|
9182
|
+
* fetching every body costs one extra `GetRolePolicy` per inline
|
|
9183
|
+
* policy. Tell the drift comparator to skip the whole subtree until a
|
|
9184
|
+
* dedicated PR adds proper inline-policy drift via per-name
|
|
9185
|
+
* `GetRolePolicy`.
|
|
9186
|
+
*/
|
|
9187
|
+
getDriftUnknownPaths() {
|
|
9188
|
+
return ["Policies"];
|
|
9189
|
+
}
|
|
9178
9190
|
/**
|
|
9179
9191
|
* Adopt an existing IAM role into cdkd state.
|
|
9180
9192
|
*
|
|
@@ -13568,6 +13580,18 @@ var SNSTopicProvider = class {
|
|
|
13568
13580
|
}
|
|
13569
13581
|
return result;
|
|
13570
13582
|
}
|
|
13583
|
+
/**
|
|
13584
|
+
* `DeliveryStatusLogging` fans out to per-protocol attributes
|
|
13585
|
+
* (`{Protocol}SuccessFeedbackRoleArn` etc.) whose round-trip back to the
|
|
13586
|
+
* CFn array shape is not yet implemented; `Subscription` is managed via
|
|
13587
|
+
* separate `AWS::SNS::Subscription` resources rather than the Topic
|
|
13588
|
+
* itself. Both are absent from `readCurrentState`, so tell the drift
|
|
13589
|
+
* comparator to skip them and avoid the guaranteed false-positive that
|
|
13590
|
+
* would fire on every clean run when the user did template either.
|
|
13591
|
+
*/
|
|
13592
|
+
getDriftUnknownPaths() {
|
|
13593
|
+
return ["DeliveryStatusLogging", "Subscription"];
|
|
13594
|
+
}
|
|
13571
13595
|
/**
|
|
13572
13596
|
* Adopt an existing SNS topic into cdkd state.
|
|
13573
13597
|
*
|
|
@@ -14843,6 +14867,17 @@ var LambdaFunctionProvider = class {
|
|
|
14843
14867
|
throw err;
|
|
14844
14868
|
}
|
|
14845
14869
|
}
|
|
14870
|
+
/**
|
|
14871
|
+
* `Code: { S3Bucket, S3Key }` is set on create / update but `GetFunction`
|
|
14872
|
+
* only returns a pre-signed URL for the deployed code, never the original
|
|
14873
|
+
* asset key — so a state-recorded `Code` value can never match an
|
|
14874
|
+
* AWS-current snapshot. Tell the drift comparator to skip the whole
|
|
14875
|
+
* `Code` subtree to avoid the guaranteed false-positive that would fire
|
|
14876
|
+
* on every clean run.
|
|
14877
|
+
*/
|
|
14878
|
+
getDriftUnknownPaths() {
|
|
14879
|
+
return ["Code"];
|
|
14880
|
+
}
|
|
14846
14881
|
/**
|
|
14847
14882
|
* Adopt an existing Lambda function into cdkd state.
|
|
14848
14883
|
*
|
|
@@ -15986,6 +16021,16 @@ var LambdaLayerVersionProvider = class {
|
|
|
15986
16021
|
}
|
|
15987
16022
|
return result;
|
|
15988
16023
|
}
|
|
16024
|
+
/**
|
|
16025
|
+
* `Content: { S3Bucket, S3Key }` is set on create but
|
|
16026
|
+
* `GetLayerVersionByArn` only returns a pre-signed URL for the deployed
|
|
16027
|
+
* content — the original asset key is unrecoverable. Tell the drift
|
|
16028
|
+
* comparator to skip the whole `Content` subtree to avoid the guaranteed
|
|
16029
|
+
* false-positive that would fire on every clean run.
|
|
16030
|
+
*/
|
|
16031
|
+
getDriftUnknownPaths() {
|
|
16032
|
+
return ["Content"];
|
|
16033
|
+
}
|
|
15989
16034
|
/**
|
|
15990
16035
|
* Adopt an existing Lambda layer version into cdkd state.
|
|
15991
16036
|
*
|
|
@@ -17519,6 +17564,16 @@ var SecretsManagerSecretProvider = class {
|
|
|
17519
17564
|
throw err;
|
|
17520
17565
|
}
|
|
17521
17566
|
}
|
|
17567
|
+
/**
|
|
17568
|
+
* `SecretString` and `GenerateSecretString` are set on create but
|
|
17569
|
+
* `DescribeSecret` does not return the secret value (that lives behind
|
|
17570
|
+
* `GetSecretValue`, which we deliberately never call to avoid surfacing
|
|
17571
|
+
* plaintext through drift). Tell the drift comparator to skip both keys
|
|
17572
|
+
* so they don't fire guaranteed false-positive drift on every clean run.
|
|
17573
|
+
*/
|
|
17574
|
+
getDriftUnknownPaths() {
|
|
17575
|
+
return ["SecretString", "GenerateSecretString"];
|
|
17576
|
+
}
|
|
17522
17577
|
/**
|
|
17523
17578
|
* Adopt an existing Secrets Manager secret into cdkd state.
|
|
17524
17579
|
*
|
|
@@ -38531,19 +38586,34 @@ import { Command as Command6, Option as Option3 } from "commander";
|
|
|
38531
38586
|
init_aws_clients();
|
|
38532
38587
|
|
|
38533
38588
|
// src/analyzer/drift-calculator.ts
|
|
38534
|
-
function calculateResourceDrift(stateProperties, awsProperties) {
|
|
38589
|
+
function calculateResourceDrift(stateProperties, awsProperties, options) {
|
|
38535
38590
|
const drifts = [];
|
|
38591
|
+
const ignore = options?.ignorePaths ?? [];
|
|
38536
38592
|
for (const key of Object.keys(stateProperties)) {
|
|
38537
|
-
|
|
38593
|
+
if (isIgnoredPath(key, ignore))
|
|
38594
|
+
continue;
|
|
38595
|
+
diffAt(key, stateProperties[key], awsProperties[key], drifts, ignore);
|
|
38538
38596
|
}
|
|
38539
38597
|
return drifts;
|
|
38540
38598
|
}
|
|
38541
|
-
function
|
|
38599
|
+
function isIgnoredPath(path, ignorePaths) {
|
|
38600
|
+
for (const entry of ignorePaths) {
|
|
38601
|
+
if (path === entry)
|
|
38602
|
+
return true;
|
|
38603
|
+
if (path.startsWith(`${entry}.`))
|
|
38604
|
+
return true;
|
|
38605
|
+
}
|
|
38606
|
+
return false;
|
|
38607
|
+
}
|
|
38608
|
+
function diffAt(path, stateValue, awsValue, out, ignorePaths) {
|
|
38542
38609
|
if (deepEqual(stateValue, awsValue))
|
|
38543
38610
|
return;
|
|
38544
38611
|
if (isPlainObject(stateValue) && isPlainObject(awsValue) && !Array.isArray(stateValue) && !Array.isArray(awsValue)) {
|
|
38545
38612
|
for (const key of Object.keys(stateValue)) {
|
|
38546
|
-
|
|
38613
|
+
const childPath = `${path}.${key}`;
|
|
38614
|
+
if (isIgnoredPath(childPath, ignorePaths))
|
|
38615
|
+
continue;
|
|
38616
|
+
diffAt(childPath, stateValue[key], awsValue[key], out, ignorePaths);
|
|
38547
38617
|
}
|
|
38548
38618
|
return;
|
|
38549
38619
|
}
|
|
@@ -38721,9 +38791,6 @@ async function driftCommand(stacks, options) {
|
|
|
38721
38791
|
logger.setLevel("debug");
|
|
38722
38792
|
}
|
|
38723
38793
|
warnIfDeprecatedRegion(options);
|
|
38724
|
-
if (!options.all && stacks.length === 0) {
|
|
38725
|
-
throw new Error("Stack name is required. Usage: cdkd drift <stack> [<stack>...] | --all");
|
|
38726
|
-
}
|
|
38727
38794
|
if (options.accept && options.revert) {
|
|
38728
38795
|
throw new Error(
|
|
38729
38796
|
"--accept and --revert are mutually exclusive. Use --accept to update cdkd state from AWS, or --revert to push cdkd state values back into AWS."
|
|
@@ -38804,6 +38871,21 @@ function resolveTargetRefs(stacks, stateRefs, options) {
|
|
|
38804
38871
|
}
|
|
38805
38872
|
return stateRefs;
|
|
38806
38873
|
}
|
|
38874
|
+
if (stacks.length === 0) {
|
|
38875
|
+
const candidates = options.stackRegion ? stateRefs.filter((r) => r.region === options.stackRegion) : stateRefs;
|
|
38876
|
+
if (candidates.length === 0) {
|
|
38877
|
+
throw new Error(
|
|
38878
|
+
"No stacks found in state bucket. Run `cdkd deploy` first, or pass --all explicitly."
|
|
38879
|
+
);
|
|
38880
|
+
}
|
|
38881
|
+
if (candidates.length === 1) {
|
|
38882
|
+
return [candidates[0]];
|
|
38883
|
+
}
|
|
38884
|
+
const listing = candidates.map((r) => `${r.stackName}${r.region ? ` (${r.region})` : ""}`).join(", ");
|
|
38885
|
+
throw new Error(
|
|
38886
|
+
`Multiple stacks found in state: ${listing}. Specify stack name(s) or use --all.`
|
|
38887
|
+
);
|
|
38888
|
+
}
|
|
38807
38889
|
const out = [];
|
|
38808
38890
|
for (const stackName of stacks) {
|
|
38809
38891
|
const matches = stateRefs.filter((r) => r.stackName === stackName);
|
|
@@ -38901,7 +38983,8 @@ async function runDriftForStack(stackName, region, stateBackend, providerRegistr
|
|
|
38901
38983
|
});
|
|
38902
38984
|
continue;
|
|
38903
38985
|
}
|
|
38904
|
-
const
|
|
38986
|
+
const ignorePaths = provider.getDriftUnknownPaths ? provider.getDriftUnknownPaths(resource.resourceType) : [];
|
|
38987
|
+
const changes = calculateResourceDrift(resource.properties ?? {}, aws, { ignorePaths });
|
|
38905
38988
|
if (changes.length === 0) {
|
|
38906
38989
|
outcomes.push({ kind: "clean", logicalId, resourceType: resource.resourceType });
|
|
38907
38990
|
} else {
|
|
@@ -42448,7 +42531,7 @@ function reorderArgs(argv) {
|
|
|
42448
42531
|
}
|
|
42449
42532
|
async function main() {
|
|
42450
42533
|
const program = new Command14();
|
|
42451
|
-
program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.46.
|
|
42534
|
+
program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.46.1");
|
|
42452
42535
|
program.addCommand(createBootstrapCommand());
|
|
42453
42536
|
program.addCommand(createSynthCommand());
|
|
42454
42537
|
program.addCommand(createListCommand());
|