cdk-real-drift 0.3.9 → 0.3.11
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 +46 -1
- package/dist/cli.js +280 -201
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -744,12 +744,23 @@ function parseIgnoreRule(entry) {
|
|
|
744
744
|
* structured property covers its leaves, including array / identity-keyed elements), and a
|
|
745
745
|
* rule "MyApi/Res" covers its whole construct-path subtree "MyApi/Res/Method.Prop".
|
|
746
746
|
* Parent matching walks ancestors at each `.`, `[`, OR `/` boundary, combined with the glob.
|
|
747
|
+
*
|
|
748
|
+
* `wholeResource` marks an atomic, whole-resource target (an `added` finding — empty property
|
|
749
|
+
* path, so the target is just `<parentLogicalId>/<CC-identifier>`). Such a target has NO
|
|
750
|
+
* property subtree: the `.` / `[` inside it are DATA within the CC identifier
|
|
751
|
+
* (`example.com`, an ARN, `a[0]`), never property separators. Trimming there would walk into
|
|
752
|
+
* a DIFFERENT sibling resource whose identifier is this one extended by `.` / `[`
|
|
753
|
+
* (`MyApi/a` wrongly swallowing `MyApi/a.b`, `MyApi/a[0]`) — a silent over-suppression of the
|
|
754
|
+
* `added` out-of-band feature (issue #990). So in this mode the ancestor walk trims ONLY at
|
|
755
|
+
* `/` boundaries, which alone mark a resource boundary: a bare PARENT-resource rule (`MyLb`)
|
|
756
|
+
* still covers its added children across `/` (e.g. a listener child whose id is an ARN full
|
|
757
|
+
* of `/`, issue #903), while a rule for one whole resource can no longer reach a sibling.
|
|
747
758
|
*/
|
|
748
|
-
function pathMatches(pattern, target) {
|
|
759
|
+
function pathMatches(pattern, target, wholeResource = false) {
|
|
749
760
|
if (matchesPathGlob(pattern, target)) return true;
|
|
750
761
|
let t = target;
|
|
751
762
|
while (true) {
|
|
752
|
-
const cut = Math.max(t.lastIndexOf("."), t.lastIndexOf("["), t.lastIndexOf("/"));
|
|
763
|
+
const cut = wholeResource ? t.lastIndexOf("/") : Math.max(t.lastIndexOf("."), t.lastIndexOf("["), t.lastIndexOf("/"));
|
|
753
764
|
if (cut <= 0) break;
|
|
754
765
|
t = t.slice(0, cut);
|
|
755
766
|
if (matchesPathGlob(pattern, t)) return true;
|
|
@@ -763,12 +774,13 @@ function applyIgnores(findings, scope, config) {
|
|
|
763
774
|
return findings.map((f) => {
|
|
764
775
|
if (f.tier !== "declared" && f.tier !== "undeclared" && f.tier !== "added") return f;
|
|
765
776
|
const suffix = f.path ? `.${f.path}` : "";
|
|
777
|
+
const wholeResource = f.tier === "added";
|
|
766
778
|
const targets = [`${f.logicalId}${suffix}`];
|
|
767
779
|
if (f.constructPath) {
|
|
768
780
|
targets.push(`${withinStackPath(f.constructPath, stackName)}${suffix}`);
|
|
769
781
|
targets.push(`${f.constructPath}${suffix}`);
|
|
770
782
|
}
|
|
771
|
-
const hit = rules.find((r) => (r.stackGlob === void 0 || matchesGlob(r.stackGlob, stackName)) && (r.accountGlob === void 0 || matchesGlob(r.accountGlob, accountId)) && (r.regionGlob === void 0 || matchesGlob(r.regionGlob, region)) && targets.some((t) => pathMatches(r.pathPattern, t)));
|
|
783
|
+
const hit = rules.find((r) => (r.stackGlob === void 0 || matchesGlob(r.stackGlob, stackName)) && (r.accountGlob === void 0 || matchesGlob(r.accountGlob, accountId)) && (r.regionGlob === void 0 || matchesGlob(r.regionGlob, region)) && targets.some((t) => pathMatches(r.pathPattern, t, wholeResource)));
|
|
772
784
|
if (!hit) return f;
|
|
773
785
|
const { unrecorded: _unrecorded, ...rest } = f;
|
|
774
786
|
return {
|
|
@@ -2640,7 +2652,7 @@ const VALUE_INDEPENDENT_DEFAULT_TOPLEVEL_PATHS = {
|
|
|
2640
2652
|
"AWS::EKS::AccessEntry": new Set(["Username"]),
|
|
2641
2653
|
"AWS::Glue::Job": new Set(["MaxCapacity", "AllocatedCapacity"]),
|
|
2642
2654
|
"AWS::EC2::SecurityGroupIngress": new Set(["SourceSecurityGroupName"]),
|
|
2643
|
-
"AWS::EC2::SecurityGroupEgress": new Set(["
|
|
2655
|
+
"AWS::EC2::SecurityGroupEgress": new Set(["DestinationSecurityGroupName"]),
|
|
2644
2656
|
"AWS::DocDB::DBCluster": new Set(["PreferredMaintenanceWindow", "PreferredBackupWindow"]),
|
|
2645
2657
|
"AWS::DocDB::DBInstance": new Set(["PreferredMaintenanceWindow"]),
|
|
2646
2658
|
"AWS::Neptune::DBCluster": new Set(["PreferredMaintenanceWindow", "PreferredBackupWindow"]),
|
|
@@ -4385,8 +4397,13 @@ function stripInjectedJsonStringDefaults(declared, live, defaults) {
|
|
|
4385
4397
|
return stripObject(declared, live);
|
|
4386
4398
|
}
|
|
4387
4399
|
function isCfnGeneratedName(value, constructPath, physicalId, logicalId) {
|
|
4388
|
-
if (typeof value !== "string" ||
|
|
4400
|
+
if (typeof value !== "string" || value === physicalId) return false;
|
|
4389
4401
|
if (logicalId && value === logicalId) return true;
|
|
4402
|
+
if (logicalId && CFN_RANDOM_SUFFIX.test(value)) {
|
|
4403
|
+
const base = value.replace(CFN_RANDOM_SUFFIX, "");
|
|
4404
|
+
if (base.length > logicalId.length && base.endsWith(`-${logicalId}`)) return true;
|
|
4405
|
+
}
|
|
4406
|
+
if (!constructPath) return false;
|
|
4390
4407
|
const stackName = constructPath.split("/")[0];
|
|
4391
4408
|
if (!stackName || !CFN_RANDOM_SUFFIX.test(value)) return false;
|
|
4392
4409
|
if (value.startsWith(`${stackName}-`)) return true;
|
|
@@ -5337,6 +5354,39 @@ async function fetchManagedAliasTargets(region) {
|
|
|
5337
5354
|
function kmsListAliasesDeniedWarning(region) {
|
|
5338
5355
|
return `warning: ${region}: kms:ListAliases denied — managed-KMS-alias drift detection is degraded. A customer-managed key swapped in for an AWS-managed default (alias/aws/*) will NOT be detected (every alias/aws/* is treated as matching any live key). Grant kms:ListAliases for full coverage.`;
|
|
5339
5356
|
}
|
|
5357
|
+
/** The one-line warning emitted when ListAliases fails TRANSIENTLY (throttle / network
|
|
5358
|
+
* blip / 5xx) for a stack that declares an AWS-managed alias: the managed-vs-customer
|
|
5359
|
+
* key check is degraded for THIS stack only — the error is NOT an IAM denial, and the
|
|
5360
|
+
* region is not poisoned, so the next stack retries. Pure + exported so the wording is
|
|
5361
|
+
* unit-tested. */
|
|
5362
|
+
function kmsListAliasesTransientWarning(region) {
|
|
5363
|
+
return `warning: ${region}: kms:ListAliases failed transiently (throttle/network) — managed-KMS-alias drift detection is degraded for THIS stack and will be retried for the next stack in the region. This is NOT an IAM permission problem; no action is needed.`;
|
|
5364
|
+
}
|
|
5365
|
+
/** Pure decision for the gather-time KMS warning: given a resolved ListAliases outcome
|
|
5366
|
+
* and the two per-region dedupe sets' membership, decide WHICH warning to emit (if any)
|
|
5367
|
+
* and WHICH set to stamp. The split is the #963 fix: a TRANSIENT failure must warn with
|
|
5368
|
+
* the transient message and stamp ONLY the transient set — it must NOT stamp the
|
|
5369
|
+
* permanent-denial set, or a later stack's GENUINE denial in the same region would be
|
|
5370
|
+
* silenced. Transient and denied dedupe independently (separate sets) so neither masks
|
|
5371
|
+
* the other. `warning` is null when nothing should print (not denied, or already warned
|
|
5372
|
+
* in that region). */
|
|
5373
|
+
function kmsWarnDecision(region, resolved, deniedWarned, transientWarned) {
|
|
5374
|
+
if (!resolved.denied) return {
|
|
5375
|
+
warning: null,
|
|
5376
|
+
stampDenied: false,
|
|
5377
|
+
stampTransient: false
|
|
5378
|
+
};
|
|
5379
|
+
if (resolved.transient) return {
|
|
5380
|
+
warning: transientWarned ? null : kmsListAliasesTransientWarning(region),
|
|
5381
|
+
stampDenied: false,
|
|
5382
|
+
stampTransient: !transientWarned
|
|
5383
|
+
};
|
|
5384
|
+
return {
|
|
5385
|
+
warning: deniedWarned ? null : kmsListAliasesDeniedWarning(region),
|
|
5386
|
+
stampDenied: !deniedWarned,
|
|
5387
|
+
stampTransient: false
|
|
5388
|
+
};
|
|
5389
|
+
}
|
|
5340
5390
|
/** True when any resolved declared value in the stack references an AWS-managed KMS
|
|
5341
5391
|
* alias, i.e. a ListAliases prefetch is worth doing. */
|
|
5342
5392
|
function usesManagedKmsAlias(v) {
|
|
@@ -5348,6 +5398,10 @@ function usesManagedKmsAlias(v) {
|
|
|
5348
5398
|
|
|
5349
5399
|
//#endregion
|
|
5350
5400
|
//#region src/read/child-enumerators.ts
|
|
5401
|
+
function parentRefMatches(declaredValue, ...candidates) {
|
|
5402
|
+
if (declaredValue === UNRESOLVED || hasUnresolved(declaredValue)) return true;
|
|
5403
|
+
return candidates.some((c) => c !== void 0 && declaredValue === c);
|
|
5404
|
+
}
|
|
5351
5405
|
const CHILD_ENUMERATORS = {
|
|
5352
5406
|
"AWS::ApiGateway::RestApi": enumerateRestApiChildren,
|
|
5353
5407
|
"AWS::ApiGatewayV2::Api": enumerateHttpApiChildren,
|
|
@@ -5433,7 +5487,7 @@ async function enumerateRestApiChildren(ctx) {
|
|
|
5433
5487
|
const declaredResourceIds = [];
|
|
5434
5488
|
const declaredMethodKeys = [];
|
|
5435
5489
|
for (const r of desired.resources) {
|
|
5436
|
-
if (r.declared.RestApiId
|
|
5490
|
+
if (!parentRefMatches(r.declared.RestApiId, apiId)) continue;
|
|
5437
5491
|
if (r.resourceType === "AWS::ApiGateway::Resource" && r.physicalId) declaredResourceIds.push(r.physicalId);
|
|
5438
5492
|
else if (r.resourceType === "AWS::ApiGateway::Method") {
|
|
5439
5493
|
const rid = r.declared.ResourceId;
|
|
@@ -5445,12 +5499,12 @@ async function enumerateRestApiChildren(ctx) {
|
|
|
5445
5499
|
const declaredModelNames = [];
|
|
5446
5500
|
const declaredValidatorIds = [];
|
|
5447
5501
|
const declaredResponseTypes = [];
|
|
5448
|
-
for (const r of desired.resources) if (r.resourceType === "AWS::ApiGateway::Authorizer" && r.declared.RestApiId
|
|
5449
|
-
else if (r.resourceType === "AWS::ApiGateway::Model" && r.declared.RestApiId
|
|
5502
|
+
for (const r of desired.resources) if (r.resourceType === "AWS::ApiGateway::Authorizer" && parentRefMatches(r.declared.RestApiId, apiId) && r.physicalId) declaredAuthorizerIds.push(r.physicalId);
|
|
5503
|
+
else if (r.resourceType === "AWS::ApiGateway::Model" && parentRefMatches(r.declared.RestApiId, apiId)) {
|
|
5450
5504
|
const name = typeof r.declared.Name === "string" ? r.declared.Name : r.physicalId;
|
|
5451
5505
|
if (name) declaredModelNames.push(name);
|
|
5452
|
-
} else if (r.resourceType === "AWS::ApiGateway::RequestValidator" && r.declared.RestApiId
|
|
5453
|
-
else if (r.resourceType === "AWS::ApiGateway::GatewayResponse" && r.declared.RestApiId
|
|
5506
|
+
} else if (r.resourceType === "AWS::ApiGateway::RequestValidator" && parentRefMatches(r.declared.RestApiId, apiId) && r.physicalId) declaredValidatorIds.push(r.physicalId);
|
|
5507
|
+
else if (r.resourceType === "AWS::ApiGateway::GatewayResponse" && parentRefMatches(r.declared.RestApiId, apiId) && typeof r.declared.ResponseType === "string") declaredResponseTypes.push(r.declared.ResponseType);
|
|
5454
5508
|
const client = new APIGatewayClient({
|
|
5455
5509
|
region,
|
|
5456
5510
|
...READ_RETRY
|
|
@@ -5784,7 +5838,7 @@ async function enumerateHttpApiChildren(ctx) {
|
|
|
5784
5838
|
const declaredAuthorizerIds = [];
|
|
5785
5839
|
const declaredStageNames = [];
|
|
5786
5840
|
for (const r of desired.resources) {
|
|
5787
|
-
if (r.declared.ApiId
|
|
5841
|
+
if (!parentRefMatches(r.declared.ApiId, apiId)) continue;
|
|
5788
5842
|
if (r.resourceType === "AWS::ApiGatewayV2::Route" && r.physicalId) declaredRouteIds.push(r.physicalId);
|
|
5789
5843
|
else if (r.resourceType === "AWS::ApiGatewayV2::Integration" && r.physicalId) declaredIntegrationIds.push(r.physicalId);
|
|
5790
5844
|
else if (r.resourceType === "AWS::ApiGatewayV2::Authorizer" && r.physicalId) declaredAuthorizerIds.push(r.physicalId);
|
|
@@ -5869,7 +5923,7 @@ async function enumerateSnsTopicChildren(ctx) {
|
|
|
5869
5923
|
const topicArn = parent.physicalId;
|
|
5870
5924
|
if (!topicArn) return [];
|
|
5871
5925
|
const declaredSubscriptionArns = [];
|
|
5872
|
-
for (const r of desired.resources) if (r.resourceType === "AWS::SNS::Subscription" && r.declared.TopicArn
|
|
5926
|
+
for (const r of desired.resources) if (r.resourceType === "AWS::SNS::Subscription" && parentRefMatches(r.declared.TopicArn, topicArn) && r.physicalId) declaredSubscriptionArns.push(r.physicalId);
|
|
5873
5927
|
return diffSnsTopicChildren({
|
|
5874
5928
|
declaredSubscriptionArns,
|
|
5875
5929
|
liveSubscriptions: (await pageSubscriptions(new SNSClient({
|
|
@@ -6000,13 +6054,13 @@ async function enumerateLambdaFunctionChildren(ctx) {
|
|
|
6000
6054
|
for (const r of desired.resources) {
|
|
6001
6055
|
if (r.resourceType !== "AWS::Lambda::EventSourceMapping" || !r.physicalId) continue;
|
|
6002
6056
|
const fn = r.declared.FunctionName;
|
|
6003
|
-
if (fn
|
|
6057
|
+
if (parentRefMatches(fn, functionName, fnArn)) declaredMappingIds.push(r.physicalId);
|
|
6004
6058
|
}
|
|
6005
6059
|
const declaredUrlArns = [];
|
|
6006
6060
|
for (const r of desired.resources) {
|
|
6007
6061
|
if (r.resourceType !== "AWS::Lambda::Url") continue;
|
|
6008
6062
|
const target = r.declared.TargetFunctionArn;
|
|
6009
|
-
if (target
|
|
6063
|
+
if (parentRefMatches(target, functionName, fnArn)) {
|
|
6010
6064
|
if (fnArn !== void 0) declaredUrlArns.push(fnArn);
|
|
6011
6065
|
if (r.physicalId) declaredUrlArns.push(r.physicalId);
|
|
6012
6066
|
} else if (r.physicalId) declaredUrlArns.push(r.physicalId);
|
|
@@ -6014,14 +6068,12 @@ async function enumerateLambdaFunctionChildren(ctx) {
|
|
|
6014
6068
|
const declaredAliasArns = [];
|
|
6015
6069
|
for (const r of desired.resources) {
|
|
6016
6070
|
if (r.resourceType !== "AWS::Lambda::Alias" || !r.physicalId) continue;
|
|
6017
|
-
|
|
6018
|
-
if (fn === functionName || fnArn !== void 0 && fn === fnArn || fn === void 0) declaredAliasArns.push(r.physicalId);
|
|
6071
|
+
if (parentRefMatches(r.declared.FunctionName, functionName, fnArn)) declaredAliasArns.push(r.physicalId);
|
|
6019
6072
|
}
|
|
6020
6073
|
const declaredVersionArns = [];
|
|
6021
6074
|
for (const r of desired.resources) {
|
|
6022
6075
|
if (r.resourceType !== "AWS::Lambda::Version" || !r.physicalId) continue;
|
|
6023
|
-
|
|
6024
|
-
if (fn === functionName || fnArn !== void 0 && fn === fnArn || fn === void 0) declaredVersionArns.push(r.physicalId);
|
|
6076
|
+
if (parentRefMatches(r.declared.FunctionName, functionName, fnArn)) declaredVersionArns.push(r.physicalId);
|
|
6025
6077
|
}
|
|
6026
6078
|
const client = new LambdaClient({
|
|
6027
6079
|
region,
|
|
@@ -6102,7 +6154,7 @@ async function enumerateEventBusChildren(ctx) {
|
|
|
6102
6154
|
for (const r of desired.resources) {
|
|
6103
6155
|
if (r.resourceType !== "AWS::Events::Rule") continue;
|
|
6104
6156
|
const bus = r.declared.EventBusName;
|
|
6105
|
-
if (
|
|
6157
|
+
if (!parentRefMatches(bus, busName, busArn)) continue;
|
|
6106
6158
|
const raw = r.physicalId ?? (typeof r.declared.Name === "string" ? r.declared.Name : void 0);
|
|
6107
6159
|
if (raw) declaredRuleNames.push(raw.includes("|") ? raw.slice(raw.lastIndexOf("|") + 1) : raw);
|
|
6108
6160
|
}
|
|
@@ -6218,11 +6270,11 @@ async function enumerateUserPoolChildren(ctx) {
|
|
|
6218
6270
|
const declaredClientIds = [];
|
|
6219
6271
|
const declaredGroupNames = [];
|
|
6220
6272
|
const declaredResourceServerIdentifiers = [];
|
|
6221
|
-
for (const r of desired.resources) if (r.resourceType === "AWS::Cognito::UserPoolClient" && r.declared.UserPoolId
|
|
6222
|
-
else if (r.resourceType === "AWS::Cognito::UserPoolGroup" && r.declared.UserPoolId
|
|
6273
|
+
for (const r of desired.resources) if (r.resourceType === "AWS::Cognito::UserPoolClient" && parentRefMatches(r.declared.UserPoolId, userPoolId) && r.physicalId) declaredClientIds.push(r.physicalId);
|
|
6274
|
+
else if (r.resourceType === "AWS::Cognito::UserPoolGroup" && parentRefMatches(r.declared.UserPoolId, userPoolId)) {
|
|
6223
6275
|
const name = typeof r.declared.GroupName === "string" ? r.declared.GroupName : r.physicalId;
|
|
6224
6276
|
if (name) declaredGroupNames.push(name);
|
|
6225
|
-
} else if (r.resourceType === "AWS::Cognito::UserPoolResourceServer" && r.declared.UserPoolId
|
|
6277
|
+
} else if (r.resourceType === "AWS::Cognito::UserPoolResourceServer" && parentRefMatches(r.declared.UserPoolId, userPoolId)) {
|
|
6226
6278
|
const identifier = typeof r.declared.Identifier === "string" ? r.declared.Identifier : r.physicalId;
|
|
6227
6279
|
if (identifier) declaredResourceServerIdentifiers.push(identifier);
|
|
6228
6280
|
}
|
|
@@ -6367,16 +6419,18 @@ async function enumerateGraphQLApiChildren(ctx) {
|
|
|
6367
6419
|
for (const r of desired.resources) {
|
|
6368
6420
|
if (r.resourceType !== "AWS::AppSync::DataSource" || typeof r.declared.Name !== "string") continue;
|
|
6369
6421
|
const declaredApiId = r.declared.ApiId;
|
|
6370
|
-
if (
|
|
6371
|
-
|
|
6422
|
+
if (declaredApiId !== UNRESOLVED && !hasUnresolved(declaredApiId)) {
|
|
6423
|
+
if (typeof declaredApiId !== "string" || bareApiId(declaredApiId) !== apiId) continue;
|
|
6424
|
+
}
|
|
6372
6425
|
declaredDataSourceNames.push(r.declared.Name);
|
|
6373
6426
|
}
|
|
6374
6427
|
const declaredResolverKeys = [];
|
|
6375
6428
|
for (const r of desired.resources) {
|
|
6376
6429
|
if (r.resourceType !== "AWS::AppSync::Resolver") continue;
|
|
6377
6430
|
const declaredApiId = r.declared.ApiId;
|
|
6378
|
-
if (
|
|
6379
|
-
|
|
6431
|
+
if (declaredApiId !== UNRESOLVED && !hasUnresolved(declaredApiId)) {
|
|
6432
|
+
if (typeof declaredApiId !== "string" || bareApiId(declaredApiId) !== apiId) continue;
|
|
6433
|
+
}
|
|
6380
6434
|
const { TypeName, FieldName } = r.declared;
|
|
6381
6435
|
if (typeof TypeName !== "string" || typeof FieldName !== "string") continue;
|
|
6382
6436
|
declaredResolverKeys.push(`${TypeName}|${FieldName}`);
|
|
@@ -6385,8 +6439,9 @@ async function enumerateGraphQLApiChildren(ctx) {
|
|
|
6385
6439
|
for (const r of desired.resources) {
|
|
6386
6440
|
if (r.resourceType !== "AWS::AppSync::FunctionConfiguration" || !r.physicalId) continue;
|
|
6387
6441
|
const declaredApiId = r.declared.ApiId;
|
|
6388
|
-
if (
|
|
6389
|
-
|
|
6442
|
+
if (declaredApiId !== UNRESOLVED && !hasUnresolved(declaredApiId)) {
|
|
6443
|
+
if (typeof declaredApiId !== "string" || bareApiId(declaredApiId) !== apiId) continue;
|
|
6444
|
+
}
|
|
6390
6445
|
declaredFunctionArns.push(r.physicalId);
|
|
6391
6446
|
}
|
|
6392
6447
|
const client = new AppSyncClient({
|
|
@@ -6484,13 +6539,13 @@ async function enumerateLogGroupChildren(ctx) {
|
|
|
6484
6539
|
if (!logGroupName) return [];
|
|
6485
6540
|
const declaredFilterNames = [];
|
|
6486
6541
|
for (const r of desired.resources) {
|
|
6487
|
-
if (r.resourceType !== "AWS::Logs::MetricFilter" || r.declared.LogGroupName
|
|
6542
|
+
if (r.resourceType !== "AWS::Logs::MetricFilter" || !parentRefMatches(r.declared.LogGroupName, logGroupName)) continue;
|
|
6488
6543
|
const name = typeof r.declared.FilterName === "string" ? r.declared.FilterName : r.physicalId;
|
|
6489
6544
|
if (name) declaredFilterNames.push(name);
|
|
6490
6545
|
}
|
|
6491
6546
|
const declaredSubscriptionNames = [];
|
|
6492
6547
|
for (const r of desired.resources) {
|
|
6493
|
-
if (r.resourceType !== "AWS::Logs::SubscriptionFilter" || r.declared.LogGroupName
|
|
6548
|
+
if (r.resourceType !== "AWS::Logs::SubscriptionFilter" || !parentRefMatches(r.declared.LogGroupName, logGroupName)) continue;
|
|
6494
6549
|
const name = typeof r.declared.FilterName === "string" ? r.declared.FilterName : r.physicalId;
|
|
6495
6550
|
if (name) declaredSubscriptionNames.push(name);
|
|
6496
6551
|
}
|
|
@@ -6542,7 +6597,7 @@ async function enumerateLoadBalancerChildren(ctx) {
|
|
|
6542
6597
|
const lbArn = parent.physicalId;
|
|
6543
6598
|
if (!lbArn) return [];
|
|
6544
6599
|
const declaredListenerArns = [];
|
|
6545
|
-
for (const r of desired.resources) if (r.resourceType === "AWS::ElasticLoadBalancingV2::Listener" && r.declared.LoadBalancerArn
|
|
6600
|
+
for (const r of desired.resources) if (r.resourceType === "AWS::ElasticLoadBalancingV2::Listener" && parentRefMatches(r.declared.LoadBalancerArn, lbArn) && r.physicalId) declaredListenerArns.push(r.physicalId);
|
|
6546
6601
|
return diffLoadBalancerChildren({
|
|
6547
6602
|
declaredListenerArns,
|
|
6548
6603
|
liveListeners: (await pageListeners(new ElasticLoadBalancingV2Client({
|
|
@@ -6586,7 +6641,7 @@ async function enumerateListenerChildren(ctx) {
|
|
|
6586
6641
|
const listenerArn = parent.physicalId;
|
|
6587
6642
|
if (!listenerArn) return [];
|
|
6588
6643
|
const declaredRuleArns = [];
|
|
6589
|
-
for (const r of desired.resources) if (r.resourceType === "AWS::ElasticLoadBalancingV2::ListenerRule" && r.declared.ListenerArn
|
|
6644
|
+
for (const r of desired.resources) if (r.resourceType === "AWS::ElasticLoadBalancingV2::ListenerRule" && parentRefMatches(r.declared.ListenerArn, listenerArn) && r.physicalId) declaredRuleArns.push(r.physicalId);
|
|
6590
6645
|
return diffListenerChildren({
|
|
6591
6646
|
declaredRuleArns,
|
|
6592
6647
|
liveRules: (await pageListenerRules(new ElasticLoadBalancingV2Client({
|
|
@@ -6633,7 +6688,7 @@ async function enumerateVpcChildren(ctx) {
|
|
|
6633
6688
|
const vpcId = parent.physicalId;
|
|
6634
6689
|
if (!vpcId) return [];
|
|
6635
6690
|
const declaredSubnetIds = [];
|
|
6636
|
-
for (const r of desired.resources) if (r.resourceType === "AWS::EC2::Subnet" && r.declared.VpcId
|
|
6691
|
+
for (const r of desired.resources) if (r.resourceType === "AWS::EC2::Subnet" && parentRefMatches(r.declared.VpcId, vpcId) && r.physicalId) declaredSubnetIds.push(r.physicalId);
|
|
6637
6692
|
return diffVpcChildren({
|
|
6638
6693
|
declaredSubnetIds,
|
|
6639
6694
|
liveSubnets: (await pageSubnets(new EC2Client({
|
|
@@ -6674,7 +6729,7 @@ async function enumerateRouteTableChildren(ctx) {
|
|
|
6674
6729
|
const routeTableId = parent.physicalId;
|
|
6675
6730
|
if (!routeTableId) return [];
|
|
6676
6731
|
const declaredCidrs = [];
|
|
6677
|
-
for (const r of desired.resources) if (r.resourceType === "AWS::EC2::Route" && r.declared.RouteTableId
|
|
6732
|
+
for (const r of desired.resources) if (r.resourceType === "AWS::EC2::Route" && parentRefMatches(r.declared.RouteTableId, routeTableId) && typeof r.declared.DestinationCidrBlock === "string") declaredCidrs.push(r.declared.DestinationCidrBlock);
|
|
6678
6733
|
return diffRouteTableChildren({
|
|
6679
6734
|
routeTableId,
|
|
6680
6735
|
declaredCidrs,
|
|
@@ -6722,7 +6777,7 @@ async function enumerateEcsClusterChildren(ctx) {
|
|
|
6722
6777
|
for (const r of desired.resources) {
|
|
6723
6778
|
if (r.resourceType !== "AWS::ECS::Service" || !r.physicalId) continue;
|
|
6724
6779
|
const decl = r.declared.Cluster;
|
|
6725
|
-
if (decl
|
|
6780
|
+
if (parentRefMatches(decl, cluster, clusterArn)) declaredServiceArns.push(r.physicalId);
|
|
6726
6781
|
}
|
|
6727
6782
|
return diffEcsClusterChildren({
|
|
6728
6783
|
cluster,
|
|
@@ -6773,7 +6828,7 @@ async function enumerateKmsKeyChildren(ctx) {
|
|
|
6773
6828
|
for (const r of desired.resources) {
|
|
6774
6829
|
if (r.resourceType !== "AWS::KMS::Alias") continue;
|
|
6775
6830
|
const target = r.declared.TargetKeyId;
|
|
6776
|
-
if (
|
|
6831
|
+
if (!parentRefMatches(target, keyId, keyArn)) continue;
|
|
6777
6832
|
const name = typeof r.declared.AliasName === "string" ? r.declared.AliasName : r.physicalId;
|
|
6778
6833
|
if (name) declaredAliasNames.push(name);
|
|
6779
6834
|
}
|
|
@@ -6853,8 +6908,8 @@ async function enumerateAppConfigApplicationChildren(ctx) {
|
|
|
6853
6908
|
if (!applicationId) return [];
|
|
6854
6909
|
const declaredEnvironmentIds = [];
|
|
6855
6910
|
const declaredProfileIds = [];
|
|
6856
|
-
for (const r of desired.resources) if (r.resourceType === "AWS::AppConfig::Environment" && r.declared.ApplicationId
|
|
6857
|
-
else if (r.resourceType === "AWS::AppConfig::ConfigurationProfile" && r.declared.ApplicationId
|
|
6911
|
+
for (const r of desired.resources) if (r.resourceType === "AWS::AppConfig::Environment" && parentRefMatches(r.declared.ApplicationId, applicationId) && r.physicalId) declaredEnvironmentIds.push(r.physicalId);
|
|
6912
|
+
else if (r.resourceType === "AWS::AppConfig::ConfigurationProfile" && parentRefMatches(r.declared.ApplicationId, applicationId) && r.physicalId) declaredProfileIds.push(r.physicalId);
|
|
6858
6913
|
const client = new AppConfigClient({
|
|
6859
6914
|
region,
|
|
6860
6915
|
...READ_RETRY
|
|
@@ -6909,7 +6964,7 @@ async function enumerateEfsFileSystemChildren(ctx) {
|
|
|
6909
6964
|
const fileSystemId = parent.physicalId;
|
|
6910
6965
|
if (!fileSystemId) return [];
|
|
6911
6966
|
const declaredMountTargetIds = [];
|
|
6912
|
-
for (const r of desired.resources) if (r.resourceType === "AWS::EFS::MountTarget" && r.declared.FileSystemId
|
|
6967
|
+
for (const r of desired.resources) if (r.resourceType === "AWS::EFS::MountTarget" && parentRefMatches(r.declared.FileSystemId, fileSystemId) && r.physicalId) declaredMountTargetIds.push(r.physicalId);
|
|
6913
6968
|
return diffEfsFileSystemChildren({
|
|
6914
6969
|
declaredMountTargetIds,
|
|
6915
6970
|
liveMountTargets: (await pageMountTargets(new EFSClient({
|
|
@@ -6960,7 +7015,7 @@ async function enumerateRdsClusterChildren(ctx) {
|
|
|
6960
7015
|
const clusterId = parent.physicalId;
|
|
6961
7016
|
if (!clusterId) return [];
|
|
6962
7017
|
const declaredInstanceIds = [];
|
|
6963
|
-
for (const r of desired.resources) if (r.resourceType === "AWS::RDS::DBInstance" && r.declared.DBClusterIdentifier
|
|
7018
|
+
for (const r of desired.resources) if (r.resourceType === "AWS::RDS::DBInstance" && parentRefMatches(r.declared.DBClusterIdentifier, clusterId) && r.physicalId) declaredInstanceIds.push(r.physicalId);
|
|
6964
7019
|
const client = new RDSClient({
|
|
6965
7020
|
region,
|
|
6966
7021
|
...READ_RETRY
|
|
@@ -8471,190 +8526,186 @@ const supplementLexBot = async ({ physicalId, region }) => {
|
|
|
8471
8526
|
region,
|
|
8472
8527
|
...READ_RETRY
|
|
8473
8528
|
});
|
|
8474
|
-
|
|
8475
|
-
|
|
8529
|
+
const localeSummaries = [];
|
|
8530
|
+
{
|
|
8531
|
+
let nextToken;
|
|
8532
|
+
do {
|
|
8533
|
+
const r = await c.send(new ListBotLocalesCommand({
|
|
8534
|
+
botId,
|
|
8535
|
+
botVersion,
|
|
8536
|
+
...nextToken && { nextToken }
|
|
8537
|
+
}));
|
|
8538
|
+
localeSummaries.push(...r.botLocaleSummaries ?? []);
|
|
8539
|
+
nextToken = r.nextToken;
|
|
8540
|
+
} while (nextToken);
|
|
8541
|
+
}
|
|
8542
|
+
const botLocales = [];
|
|
8543
|
+
for (const ls of localeSummaries) {
|
|
8544
|
+
const localeId = str$1(ls.localeId);
|
|
8545
|
+
if (!localeId) continue;
|
|
8546
|
+
const loc = await c.send(new DescribeBotLocaleCommand({
|
|
8547
|
+
botId,
|
|
8548
|
+
botVersion,
|
|
8549
|
+
localeId
|
|
8550
|
+
}));
|
|
8551
|
+
const cfnLocale = { LocaleId: localeId };
|
|
8552
|
+
const desc = str$1(loc.description);
|
|
8553
|
+
if (desc !== void 0) cfnLocale.Description = desc;
|
|
8554
|
+
if (typeof loc.nluIntentConfidenceThreshold === "number") cfnLocale.NluConfidenceThreshold = loc.nluIntentConfidenceThreshold;
|
|
8555
|
+
const voiceId = str$1(loc.voiceSettings?.voiceId);
|
|
8556
|
+
if (voiceId !== void 0) {
|
|
8557
|
+
const vs = { VoiceId: voiceId };
|
|
8558
|
+
const engine = str$1(loc.voiceSettings?.engine);
|
|
8559
|
+
if (engine !== void 0) vs.Engine = engine;
|
|
8560
|
+
cfnLocale.VoiceSettings = vs;
|
|
8561
|
+
}
|
|
8562
|
+
const slotTypeNames = /* @__PURE__ */ new Map();
|
|
8563
|
+
const slotTypeSummaries = [];
|
|
8476
8564
|
{
|
|
8477
8565
|
let nextToken;
|
|
8478
8566
|
do {
|
|
8479
|
-
const r = await c.send(new
|
|
8567
|
+
const r = await c.send(new ListSlotTypesCommand({
|
|
8480
8568
|
botId,
|
|
8481
8569
|
botVersion,
|
|
8570
|
+
localeId,
|
|
8482
8571
|
...nextToken && { nextToken }
|
|
8483
8572
|
}));
|
|
8484
|
-
|
|
8573
|
+
slotTypeSummaries.push(...r.slotTypeSummaries ?? []);
|
|
8485
8574
|
nextToken = r.nextToken;
|
|
8486
8575
|
} while (nextToken);
|
|
8487
8576
|
}
|
|
8488
|
-
const
|
|
8489
|
-
for (const
|
|
8490
|
-
const
|
|
8491
|
-
if (!
|
|
8492
|
-
|
|
8577
|
+
const cfnSlotTypes = [];
|
|
8578
|
+
for (const sts of slotTypeSummaries) {
|
|
8579
|
+
const slotTypeId = str$1(sts.slotTypeId);
|
|
8580
|
+
if (!slotTypeId) continue;
|
|
8581
|
+
if (slotTypeId.startsWith("AMAZON.")) {
|
|
8582
|
+
slotTypeNames.set(slotTypeId, slotTypeId);
|
|
8583
|
+
continue;
|
|
8584
|
+
}
|
|
8585
|
+
const st = await c.send(new DescribeSlotTypeCommand({
|
|
8493
8586
|
botId,
|
|
8494
8587
|
botVersion,
|
|
8495
|
-
localeId
|
|
8588
|
+
localeId,
|
|
8589
|
+
slotTypeId
|
|
8496
8590
|
}));
|
|
8497
|
-
const
|
|
8498
|
-
|
|
8499
|
-
|
|
8500
|
-
if (
|
|
8501
|
-
const
|
|
8502
|
-
if (
|
|
8503
|
-
|
|
8504
|
-
const
|
|
8505
|
-
|
|
8506
|
-
|
|
8507
|
-
|
|
8508
|
-
|
|
8509
|
-
|
|
8510
|
-
{
|
|
8511
|
-
let nextToken;
|
|
8512
|
-
do {
|
|
8513
|
-
const r = await c.send(new ListSlotTypesCommand({
|
|
8514
|
-
botId,
|
|
8515
|
-
botVersion,
|
|
8516
|
-
localeId,
|
|
8517
|
-
...nextToken && { nextToken }
|
|
8518
|
-
}));
|
|
8519
|
-
slotTypeSummaries.push(...r.slotTypeSummaries ?? []);
|
|
8520
|
-
nextToken = r.nextToken;
|
|
8521
|
-
} while (nextToken);
|
|
8522
|
-
}
|
|
8523
|
-
const cfnSlotTypes = [];
|
|
8524
|
-
for (const sts of slotTypeSummaries) {
|
|
8525
|
-
const slotTypeId = str$1(sts.slotTypeId);
|
|
8526
|
-
if (!slotTypeId) continue;
|
|
8527
|
-
if (slotTypeId.startsWith("AMAZON.")) {
|
|
8528
|
-
slotTypeNames.set(slotTypeId, slotTypeId);
|
|
8529
|
-
continue;
|
|
8591
|
+
const name = str$1(st.slotTypeName);
|
|
8592
|
+
if (name !== void 0) slotTypeNames.set(slotTypeId, name);
|
|
8593
|
+
const cfnSt = {};
|
|
8594
|
+
if (name !== void 0) cfnSt.Name = name;
|
|
8595
|
+
const stDesc = str$1(st.description);
|
|
8596
|
+
if (stDesc !== void 0) cfnSt.Description = stDesc;
|
|
8597
|
+
if (Array.isArray(st.slotTypeValues)) cfnSt.SlotTypeValues = st.slotTypeValues.map((v) => {
|
|
8598
|
+
const entry = {};
|
|
8599
|
+
const sv = str$1(v.sampleValue?.value);
|
|
8600
|
+
if (sv !== void 0) entry.SampleValue = { Value: sv };
|
|
8601
|
+
if (Array.isArray(v.synonyms)) {
|
|
8602
|
+
const syns = v.synonyms.map((s) => str$1(s.value)).filter((x) => x !== void 0).map((x) => ({ Value: x }));
|
|
8603
|
+
if (syns.length > 0) entry.Synonyms = syns;
|
|
8530
8604
|
}
|
|
8531
|
-
|
|
8605
|
+
return entry;
|
|
8606
|
+
});
|
|
8607
|
+
const strategy = str$1(st.valueSelectionSetting?.resolutionStrategy);
|
|
8608
|
+
if (strategy !== void 0) cfnSt.ValueSelectionSetting = { ResolutionStrategy: LEX_RESOLUTION_STRATEGY_TO_CFN[strategy] ?? strategy };
|
|
8609
|
+
cfnSlotTypes.push(cfnSt);
|
|
8610
|
+
}
|
|
8611
|
+
const intentSummaries = [];
|
|
8612
|
+
{
|
|
8613
|
+
let nextToken;
|
|
8614
|
+
do {
|
|
8615
|
+
const r = await c.send(new ListIntentsCommand({
|
|
8532
8616
|
botId,
|
|
8533
8617
|
botVersion,
|
|
8534
8618
|
localeId,
|
|
8535
|
-
|
|
8619
|
+
...nextToken && { nextToken }
|
|
8536
8620
|
}));
|
|
8537
|
-
|
|
8538
|
-
|
|
8539
|
-
|
|
8540
|
-
|
|
8541
|
-
|
|
8542
|
-
|
|
8543
|
-
|
|
8544
|
-
|
|
8545
|
-
|
|
8546
|
-
|
|
8547
|
-
|
|
8548
|
-
|
|
8549
|
-
|
|
8550
|
-
|
|
8551
|
-
|
|
8552
|
-
|
|
8553
|
-
|
|
8554
|
-
|
|
8555
|
-
|
|
8621
|
+
intentSummaries.push(...r.intentSummaries ?? []);
|
|
8622
|
+
nextToken = r.nextToken;
|
|
8623
|
+
} while (nextToken);
|
|
8624
|
+
}
|
|
8625
|
+
const cfnIntents = [];
|
|
8626
|
+
for (const is of intentSummaries) {
|
|
8627
|
+
const intentId = str$1(is.intentId);
|
|
8628
|
+
if (!intentId) continue;
|
|
8629
|
+
const intent = await c.send(new DescribeIntentCommand({
|
|
8630
|
+
botId,
|
|
8631
|
+
botVersion,
|
|
8632
|
+
localeId,
|
|
8633
|
+
intentId
|
|
8634
|
+
}));
|
|
8635
|
+
const cfnIntent = {};
|
|
8636
|
+
const iName = str$1(intent.intentName);
|
|
8637
|
+
if (iName !== void 0) cfnIntent.Name = iName;
|
|
8638
|
+
const iDesc = str$1(intent.description);
|
|
8639
|
+
if (iDesc !== void 0) cfnIntent.Description = iDesc;
|
|
8640
|
+
const parentSig = str$1(intent.parentIntentSignature);
|
|
8641
|
+
if (parentSig !== void 0) cfnIntent.ParentIntentSignature = parentSig;
|
|
8642
|
+
if (Array.isArray(intent.sampleUtterances)) {
|
|
8643
|
+
const utterances = intent.sampleUtterances.map((u) => str$1(u.utterance)).filter((x) => x !== void 0).map((x) => ({ Utterance: x }));
|
|
8644
|
+
if (utterances.length > 0) cfnIntent.SampleUtterances = utterances;
|
|
8556
8645
|
}
|
|
8557
|
-
const
|
|
8646
|
+
const slotNames = /* @__PURE__ */ new Map();
|
|
8647
|
+
const cfnSlots = [];
|
|
8648
|
+
const slotSummaries = [];
|
|
8558
8649
|
{
|
|
8559
8650
|
let nextToken;
|
|
8560
8651
|
do {
|
|
8561
|
-
const r = await c.send(new
|
|
8652
|
+
const r = await c.send(new ListSlotsCommand({
|
|
8562
8653
|
botId,
|
|
8563
8654
|
botVersion,
|
|
8564
8655
|
localeId,
|
|
8656
|
+
intentId,
|
|
8565
8657
|
...nextToken && { nextToken }
|
|
8566
8658
|
}));
|
|
8567
|
-
|
|
8659
|
+
slotSummaries.push(...r.slotSummaries ?? []);
|
|
8568
8660
|
nextToken = r.nextToken;
|
|
8569
8661
|
} while (nextToken);
|
|
8570
8662
|
}
|
|
8571
|
-
const
|
|
8572
|
-
|
|
8573
|
-
|
|
8574
|
-
|
|
8575
|
-
const intent = await c.send(new DescribeIntentCommand({
|
|
8663
|
+
for (const ss of slotSummaries) {
|
|
8664
|
+
const slotId = str$1(ss.slotId);
|
|
8665
|
+
if (!slotId) continue;
|
|
8666
|
+
const slot = await c.send(new DescribeSlotCommand({
|
|
8576
8667
|
botId,
|
|
8577
8668
|
botVersion,
|
|
8578
8669
|
localeId,
|
|
8579
|
-
intentId
|
|
8670
|
+
intentId,
|
|
8671
|
+
slotId
|
|
8580
8672
|
}));
|
|
8581
|
-
const
|
|
8582
|
-
|
|
8583
|
-
|
|
8584
|
-
|
|
8585
|
-
|
|
8586
|
-
|
|
8587
|
-
|
|
8588
|
-
if (
|
|
8589
|
-
const
|
|
8590
|
-
|
|
8673
|
+
const slotName = str$1(slot.slotName);
|
|
8674
|
+
if (slotName !== void 0) slotNames.set(slotId, slotName);
|
|
8675
|
+
const cfnSlot = {};
|
|
8676
|
+
if (slotName !== void 0) cfnSlot.Name = slotName;
|
|
8677
|
+
const slotTypeId = str$1(slot.slotTypeId);
|
|
8678
|
+
if (slotTypeId !== void 0) cfnSlot.SlotTypeName = slotTypeNames.get(slotTypeId) ?? slotTypeId;
|
|
8679
|
+
const elic = slot.valueElicitationSetting;
|
|
8680
|
+
if (elic && typeof elic === "object") {
|
|
8681
|
+
const cfnElic = {};
|
|
8682
|
+
const constraint = str$1(elic.slotConstraint);
|
|
8683
|
+
if (constraint !== void 0) cfnElic.SlotConstraint = constraint;
|
|
8684
|
+
const prompt = projectLexPrompt(elic.promptSpecification);
|
|
8685
|
+
if (prompt !== void 0) cfnElic.PromptSpecification = prompt;
|
|
8686
|
+
if (Object.keys(cfnElic).length > 0) cfnSlot.ValueElicitationSetting = cfnElic;
|
|
8591
8687
|
}
|
|
8592
|
-
|
|
8593
|
-
const cfnSlots = [];
|
|
8594
|
-
const slotSummaries = [];
|
|
8595
|
-
{
|
|
8596
|
-
let nextToken;
|
|
8597
|
-
do {
|
|
8598
|
-
const r = await c.send(new ListSlotsCommand({
|
|
8599
|
-
botId,
|
|
8600
|
-
botVersion,
|
|
8601
|
-
localeId,
|
|
8602
|
-
intentId,
|
|
8603
|
-
...nextToken && { nextToken }
|
|
8604
|
-
}));
|
|
8605
|
-
slotSummaries.push(...r.slotSummaries ?? []);
|
|
8606
|
-
nextToken = r.nextToken;
|
|
8607
|
-
} while (nextToken);
|
|
8608
|
-
}
|
|
8609
|
-
for (const ss of slotSummaries) {
|
|
8610
|
-
const slotId = str$1(ss.slotId);
|
|
8611
|
-
if (!slotId) continue;
|
|
8612
|
-
const slot = await c.send(new DescribeSlotCommand({
|
|
8613
|
-
botId,
|
|
8614
|
-
botVersion,
|
|
8615
|
-
localeId,
|
|
8616
|
-
intentId,
|
|
8617
|
-
slotId
|
|
8618
|
-
}));
|
|
8619
|
-
const slotName = str$1(slot.slotName);
|
|
8620
|
-
if (slotName !== void 0) slotNames.set(slotId, slotName);
|
|
8621
|
-
const cfnSlot = {};
|
|
8622
|
-
if (slotName !== void 0) cfnSlot.Name = slotName;
|
|
8623
|
-
const slotTypeId = str$1(slot.slotTypeId);
|
|
8624
|
-
if (slotTypeId !== void 0) cfnSlot.SlotTypeName = slotTypeNames.get(slotTypeId) ?? slotTypeId;
|
|
8625
|
-
const elic = slot.valueElicitationSetting;
|
|
8626
|
-
if (elic && typeof elic === "object") {
|
|
8627
|
-
const cfnElic = {};
|
|
8628
|
-
const constraint = str$1(elic.slotConstraint);
|
|
8629
|
-
if (constraint !== void 0) cfnElic.SlotConstraint = constraint;
|
|
8630
|
-
const prompt = projectLexPrompt(elic.promptSpecification);
|
|
8631
|
-
if (prompt !== void 0) cfnElic.PromptSpecification = prompt;
|
|
8632
|
-
if (Object.keys(cfnElic).length > 0) cfnSlot.ValueElicitationSetting = cfnElic;
|
|
8633
|
-
}
|
|
8634
|
-
cfnSlots.push(cfnSlot);
|
|
8635
|
-
}
|
|
8636
|
-
if (Array.isArray(intent.slotPriorities)) {
|
|
8637
|
-
const priorities = intent.slotPriorities.map((p) => {
|
|
8638
|
-
const slotName = str$1(p.slotId) ? slotNames.get(str$1(p.slotId)) : void 0;
|
|
8639
|
-
if (typeof p.priority !== "number" || slotName === void 0) return void 0;
|
|
8640
|
-
return {
|
|
8641
|
-
Priority: p.priority,
|
|
8642
|
-
SlotName: slotName
|
|
8643
|
-
};
|
|
8644
|
-
}).filter((x) => x !== void 0);
|
|
8645
|
-
if (priorities.length > 0) cfnIntent.SlotPriorities = priorities;
|
|
8646
|
-
}
|
|
8647
|
-
if (cfnSlots.length > 0) cfnIntent.Slots = cfnSlots;
|
|
8648
|
-
cfnIntents.push(cfnIntent);
|
|
8688
|
+
cfnSlots.push(cfnSlot);
|
|
8649
8689
|
}
|
|
8650
|
-
if (
|
|
8651
|
-
|
|
8652
|
-
|
|
8690
|
+
if (Array.isArray(intent.slotPriorities)) {
|
|
8691
|
+
const priorities = intent.slotPriorities.map((p) => {
|
|
8692
|
+
const slotName = str$1(p.slotId) ? slotNames.get(str$1(p.slotId)) : void 0;
|
|
8693
|
+
if (typeof p.priority !== "number" || slotName === void 0) return void 0;
|
|
8694
|
+
return {
|
|
8695
|
+
Priority: p.priority,
|
|
8696
|
+
SlotName: slotName
|
|
8697
|
+
};
|
|
8698
|
+
}).filter((x) => x !== void 0);
|
|
8699
|
+
if (priorities.length > 0) cfnIntent.SlotPriorities = priorities;
|
|
8700
|
+
}
|
|
8701
|
+
if (cfnSlots.length > 0) cfnIntent.Slots = cfnSlots;
|
|
8702
|
+
cfnIntents.push(cfnIntent);
|
|
8653
8703
|
}
|
|
8654
|
-
|
|
8655
|
-
|
|
8656
|
-
|
|
8704
|
+
if (cfnSlotTypes.length > 0) cfnLocale.SlotTypes = cfnSlotTypes;
|
|
8705
|
+
if (cfnIntents.length > 0) cfnLocale.Intents = cfnIntents;
|
|
8706
|
+
botLocales.push(cfnLocale);
|
|
8657
8707
|
}
|
|
8708
|
+
return botLocales.length > 0 ? { BotLocales: botLocales } : void 0;
|
|
8658
8709
|
};
|
|
8659
8710
|
const supplementElasticBeanstalkEnvironment = async ({ physicalId, declared, region }) => {
|
|
8660
8711
|
const envName = str$1(physicalId);
|
|
@@ -9106,6 +9157,7 @@ function liveModelMap(reads) {
|
|
|
9106
9157
|
return out;
|
|
9107
9158
|
}
|
|
9108
9159
|
const kmsDeniedWarned = /* @__PURE__ */ new Set();
|
|
9160
|
+
const kmsTransientWarned = /* @__PURE__ */ new Set();
|
|
9109
9161
|
const POOL_SIZE = 6;
|
|
9110
9162
|
async function readAll(cc, targets, region, desired, reads) {
|
|
9111
9163
|
let cursor = 0;
|
|
@@ -9357,10 +9409,10 @@ async function gatherFindings(stackName, region, templateOverride, recoveryTempl
|
|
|
9357
9409
|
if (desired.resources.some((r) => usesManagedKmsAlias(r.declared))) {
|
|
9358
9410
|
const resolved = await fetchManagedAliasTargets(region);
|
|
9359
9411
|
kmsAliasTargets = resolved.targets;
|
|
9360
|
-
|
|
9361
|
-
|
|
9362
|
-
|
|
9363
|
-
|
|
9412
|
+
const decision = kmsWarnDecision(region, resolved, kmsDeniedWarned.has(region), kmsTransientWarned.has(region));
|
|
9413
|
+
if (decision.stampDenied) kmsDeniedWarned.add(region);
|
|
9414
|
+
if (decision.stampTransient) kmsTransientWarned.add(region);
|
|
9415
|
+
if (decision.warning) console.error(decision.warning);
|
|
9364
9416
|
}
|
|
9365
9417
|
const classifyOpts = {
|
|
9366
9418
|
accountId: desired.accountId,
|
|
@@ -11805,8 +11857,22 @@ function nullHuskRemovalOps(model) {
|
|
|
11805
11857
|
} else if (value && typeof value === "object") for (const [k, v] of Object.entries(value)) walk(v, `${pointer}/${k.replace(/~/g, "~0").replace(/\//g, "~1")}`);
|
|
11806
11858
|
};
|
|
11807
11859
|
walk(model, "");
|
|
11860
|
+
ops.sort((a, b) => compareDocOrderDescending(a.path, b.path));
|
|
11808
11861
|
return ops;
|
|
11809
11862
|
}
|
|
11863
|
+
function compareDocOrderDescending(a, b) {
|
|
11864
|
+
const as = a.split("/").slice(1);
|
|
11865
|
+
const bs = b.split("/").slice(1);
|
|
11866
|
+
const n = Math.min(as.length, bs.length);
|
|
11867
|
+
for (let i = 0; i < n; i++) {
|
|
11868
|
+
if (as[i] === bs[i]) continue;
|
|
11869
|
+
const ai = Number(as[i]);
|
|
11870
|
+
const bi = Number(bs[i]);
|
|
11871
|
+
if (as[i] !== "" && bs[i] !== "" && Number.isInteger(ai) && Number.isInteger(bi)) return bi - ai;
|
|
11872
|
+
return as[i] < bs[i] ? 1 : -1;
|
|
11873
|
+
}
|
|
11874
|
+
return bs.length - as.length;
|
|
11875
|
+
}
|
|
11810
11876
|
function splitTopLevelDots(dotted) {
|
|
11811
11877
|
const out = [];
|
|
11812
11878
|
let cur = "";
|
|
@@ -14094,17 +14160,26 @@ function finalCheckExit(code, fail) {
|
|
|
14094
14160
|
return fail || code !== 1 ? code : 0;
|
|
14095
14161
|
}
|
|
14096
14162
|
/**
|
|
14097
|
-
* #781: does a committed baseline exist for this stack
|
|
14098
|
-
* When a stack is gone (a DescribeStacks "does not exist"), we do NOT know the
|
|
14099
|
-
* account/region it was deployed to, so we cannot construct the exact baseline path.
|
|
14163
|
+
* #781: does a committed baseline exist for this stack IN THE REGION being checked?
|
|
14100
14164
|
* A committed baseline is named `<stackName>.<accountId>.<region>.json` under
|
|
14101
|
-
* `.cdkrd/baselines
|
|
14102
|
-
*
|
|
14103
|
-
*
|
|
14104
|
-
*
|
|
14165
|
+
* `.cdkrd/baselines/`. The gone stack's ACCOUNT is unknown without an STS call, so it
|
|
14166
|
+
* stays wildcarded; but the REGION being checked IS known (the loop's `region`), and a
|
|
14167
|
+
* baseline recorded for THIS stack in THIS region carries exactly that region in its
|
|
14168
|
+
* filename — so we require the `.<region>.json` suffix. A prior baseline in this region
|
|
14169
|
+
* is PROOF the stack was once deployed THERE, which distinguishes "deleted out of band"
|
|
14170
|
+
* (real drift) from "never deployed yet" (a benign skip). Without the region gate, a
|
|
14171
|
+
* same-named stack that was never deployed in region B but has a baseline in region A is
|
|
14172
|
+
* falsely reported "deleted out of band" (#942).
|
|
14173
|
+
*
|
|
14174
|
+
* #986: the match is CASE-INSENSITIVE (both sides lowercased) so it answers consistently
|
|
14175
|
+
* with `loadBaseline`, whose `readFile` opens the file case-insensitively on macOS/Windows.
|
|
14176
|
+
* A case-sensitive `readdirSync` prefix would MISS a baseline committed as `mystack.….json`
|
|
14177
|
+
* when checking `MyStack`, silently downgrading a genuinely deleted stack to a benign skip.
|
|
14178
|
+
*
|
|
14179
|
+
* The baselines directory is derived from `baselinePath` so the layout stays single-sourced.
|
|
14105
14180
|
* Pure (filesystem-only, no AWS) + exported for unit tests. Missing dir → false.
|
|
14106
14181
|
*/
|
|
14107
|
-
function hasBaselineForStack(stackName) {
|
|
14182
|
+
function hasBaselineForStack(stackName, region) {
|
|
14108
14183
|
const dir = dirname(baselinePath(stackName, "a", "r"));
|
|
14109
14184
|
let entries;
|
|
14110
14185
|
try {
|
|
@@ -14113,7 +14188,11 @@ function hasBaselineForStack(stackName) {
|
|
|
14113
14188
|
return false;
|
|
14114
14189
|
}
|
|
14115
14190
|
const prefix = `${stackName}.`.toLowerCase();
|
|
14116
|
-
|
|
14191
|
+
const suffix = `.${region}.json`.toLowerCase();
|
|
14192
|
+
return entries.some((f) => {
|
|
14193
|
+
const lower = f.toLowerCase();
|
|
14194
|
+
return lower.startsWith(prefix) && lower.endsWith(suffix);
|
|
14195
|
+
});
|
|
14117
14196
|
}
|
|
14118
14197
|
async function runCheck(args) {
|
|
14119
14198
|
const a = parseCommonArgs(args, "check");
|
|
@@ -14245,7 +14324,7 @@ async function runCheck(args) {
|
|
|
14245
14324
|
const baseline = a.showAll ? void 0 : await loadBaseline(stackName, desired.accountId, region);
|
|
14246
14325
|
if (baseline) checkBaselineAccount(baseline, desired.accountId, stackName);
|
|
14247
14326
|
if (baseline) warnTemplateHashDrift(baseline, desired.rawTemplate, stackName);
|
|
14248
|
-
if (baseline
|
|
14327
|
+
if (baseline) warnBaselineSchemaV1(baseline, stackName);
|
|
14249
14328
|
const reconciled = applyIgnores(reconcileBaseline(findings, baseline, {
|
|
14250
14329
|
declaredOnly: a.declaredOnly,
|
|
14251
14330
|
applyOpts: {
|
|
@@ -14294,7 +14373,7 @@ async function runCheck(args) {
|
|
|
14294
14373
|
worst = Math.max(worst, strictCoverageExit(a.strict, gathered.findings, desired.resources));
|
|
14295
14374
|
} catch (e) {
|
|
14296
14375
|
if (isStackNotDeployed(e)) {
|
|
14297
|
-
if (hasBaselineForStack(stackName)) {
|
|
14376
|
+
if (hasBaselineForStack(stackName, region)) {
|
|
14298
14377
|
const msg = "deployed baseline exists but the stack is gone — deleted out of band";
|
|
14299
14378
|
const label = `${stackName} (${region})`;
|
|
14300
14379
|
console.error(`[Drift] ${label}: ${msg}`);
|