cdk-real-drift 0.3.10 → 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 +235 -186
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -5354,6 +5354,39 @@ async function fetchManagedAliasTargets(region) {
|
|
|
5354
5354
|
function kmsListAliasesDeniedWarning(region) {
|
|
5355
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.`;
|
|
5356
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
|
+
}
|
|
5357
5390
|
/** True when any resolved declared value in the stack references an AWS-managed KMS
|
|
5358
5391
|
* alias, i.e. a ListAliases prefetch is worth doing. */
|
|
5359
5392
|
function usesManagedKmsAlias(v) {
|
|
@@ -5365,6 +5398,10 @@ function usesManagedKmsAlias(v) {
|
|
|
5365
5398
|
|
|
5366
5399
|
//#endregion
|
|
5367
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
|
+
}
|
|
5368
5405
|
const CHILD_ENUMERATORS = {
|
|
5369
5406
|
"AWS::ApiGateway::RestApi": enumerateRestApiChildren,
|
|
5370
5407
|
"AWS::ApiGatewayV2::Api": enumerateHttpApiChildren,
|
|
@@ -5450,7 +5487,7 @@ async function enumerateRestApiChildren(ctx) {
|
|
|
5450
5487
|
const declaredResourceIds = [];
|
|
5451
5488
|
const declaredMethodKeys = [];
|
|
5452
5489
|
for (const r of desired.resources) {
|
|
5453
|
-
if (r.declared.RestApiId
|
|
5490
|
+
if (!parentRefMatches(r.declared.RestApiId, apiId)) continue;
|
|
5454
5491
|
if (r.resourceType === "AWS::ApiGateway::Resource" && r.physicalId) declaredResourceIds.push(r.physicalId);
|
|
5455
5492
|
else if (r.resourceType === "AWS::ApiGateway::Method") {
|
|
5456
5493
|
const rid = r.declared.ResourceId;
|
|
@@ -5462,12 +5499,12 @@ async function enumerateRestApiChildren(ctx) {
|
|
|
5462
5499
|
const declaredModelNames = [];
|
|
5463
5500
|
const declaredValidatorIds = [];
|
|
5464
5501
|
const declaredResponseTypes = [];
|
|
5465
|
-
for (const r of desired.resources) if (r.resourceType === "AWS::ApiGateway::Authorizer" && r.declared.RestApiId
|
|
5466
|
-
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)) {
|
|
5467
5504
|
const name = typeof r.declared.Name === "string" ? r.declared.Name : r.physicalId;
|
|
5468
5505
|
if (name) declaredModelNames.push(name);
|
|
5469
|
-
} else if (r.resourceType === "AWS::ApiGateway::RequestValidator" && r.declared.RestApiId
|
|
5470
|
-
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);
|
|
5471
5508
|
const client = new APIGatewayClient({
|
|
5472
5509
|
region,
|
|
5473
5510
|
...READ_RETRY
|
|
@@ -5801,7 +5838,7 @@ async function enumerateHttpApiChildren(ctx) {
|
|
|
5801
5838
|
const declaredAuthorizerIds = [];
|
|
5802
5839
|
const declaredStageNames = [];
|
|
5803
5840
|
for (const r of desired.resources) {
|
|
5804
|
-
if (r.declared.ApiId
|
|
5841
|
+
if (!parentRefMatches(r.declared.ApiId, apiId)) continue;
|
|
5805
5842
|
if (r.resourceType === "AWS::ApiGatewayV2::Route" && r.physicalId) declaredRouteIds.push(r.physicalId);
|
|
5806
5843
|
else if (r.resourceType === "AWS::ApiGatewayV2::Integration" && r.physicalId) declaredIntegrationIds.push(r.physicalId);
|
|
5807
5844
|
else if (r.resourceType === "AWS::ApiGatewayV2::Authorizer" && r.physicalId) declaredAuthorizerIds.push(r.physicalId);
|
|
@@ -5886,7 +5923,7 @@ async function enumerateSnsTopicChildren(ctx) {
|
|
|
5886
5923
|
const topicArn = parent.physicalId;
|
|
5887
5924
|
if (!topicArn) return [];
|
|
5888
5925
|
const declaredSubscriptionArns = [];
|
|
5889
|
-
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);
|
|
5890
5927
|
return diffSnsTopicChildren({
|
|
5891
5928
|
declaredSubscriptionArns,
|
|
5892
5929
|
liveSubscriptions: (await pageSubscriptions(new SNSClient({
|
|
@@ -6017,13 +6054,13 @@ async function enumerateLambdaFunctionChildren(ctx) {
|
|
|
6017
6054
|
for (const r of desired.resources) {
|
|
6018
6055
|
if (r.resourceType !== "AWS::Lambda::EventSourceMapping" || !r.physicalId) continue;
|
|
6019
6056
|
const fn = r.declared.FunctionName;
|
|
6020
|
-
if (fn
|
|
6057
|
+
if (parentRefMatches(fn, functionName, fnArn)) declaredMappingIds.push(r.physicalId);
|
|
6021
6058
|
}
|
|
6022
6059
|
const declaredUrlArns = [];
|
|
6023
6060
|
for (const r of desired.resources) {
|
|
6024
6061
|
if (r.resourceType !== "AWS::Lambda::Url") continue;
|
|
6025
6062
|
const target = r.declared.TargetFunctionArn;
|
|
6026
|
-
if (target
|
|
6063
|
+
if (parentRefMatches(target, functionName, fnArn)) {
|
|
6027
6064
|
if (fnArn !== void 0) declaredUrlArns.push(fnArn);
|
|
6028
6065
|
if (r.physicalId) declaredUrlArns.push(r.physicalId);
|
|
6029
6066
|
} else if (r.physicalId) declaredUrlArns.push(r.physicalId);
|
|
@@ -6031,14 +6068,12 @@ async function enumerateLambdaFunctionChildren(ctx) {
|
|
|
6031
6068
|
const declaredAliasArns = [];
|
|
6032
6069
|
for (const r of desired.resources) {
|
|
6033
6070
|
if (r.resourceType !== "AWS::Lambda::Alias" || !r.physicalId) continue;
|
|
6034
|
-
|
|
6035
|
-
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);
|
|
6036
6072
|
}
|
|
6037
6073
|
const declaredVersionArns = [];
|
|
6038
6074
|
for (const r of desired.resources) {
|
|
6039
6075
|
if (r.resourceType !== "AWS::Lambda::Version" || !r.physicalId) continue;
|
|
6040
|
-
|
|
6041
|
-
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);
|
|
6042
6077
|
}
|
|
6043
6078
|
const client = new LambdaClient({
|
|
6044
6079
|
region,
|
|
@@ -6119,7 +6154,7 @@ async function enumerateEventBusChildren(ctx) {
|
|
|
6119
6154
|
for (const r of desired.resources) {
|
|
6120
6155
|
if (r.resourceType !== "AWS::Events::Rule") continue;
|
|
6121
6156
|
const bus = r.declared.EventBusName;
|
|
6122
|
-
if (
|
|
6157
|
+
if (!parentRefMatches(bus, busName, busArn)) continue;
|
|
6123
6158
|
const raw = r.physicalId ?? (typeof r.declared.Name === "string" ? r.declared.Name : void 0);
|
|
6124
6159
|
if (raw) declaredRuleNames.push(raw.includes("|") ? raw.slice(raw.lastIndexOf("|") + 1) : raw);
|
|
6125
6160
|
}
|
|
@@ -6235,11 +6270,11 @@ async function enumerateUserPoolChildren(ctx) {
|
|
|
6235
6270
|
const declaredClientIds = [];
|
|
6236
6271
|
const declaredGroupNames = [];
|
|
6237
6272
|
const declaredResourceServerIdentifiers = [];
|
|
6238
|
-
for (const r of desired.resources) if (r.resourceType === "AWS::Cognito::UserPoolClient" && r.declared.UserPoolId
|
|
6239
|
-
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)) {
|
|
6240
6275
|
const name = typeof r.declared.GroupName === "string" ? r.declared.GroupName : r.physicalId;
|
|
6241
6276
|
if (name) declaredGroupNames.push(name);
|
|
6242
|
-
} else if (r.resourceType === "AWS::Cognito::UserPoolResourceServer" && r.declared.UserPoolId
|
|
6277
|
+
} else if (r.resourceType === "AWS::Cognito::UserPoolResourceServer" && parentRefMatches(r.declared.UserPoolId, userPoolId)) {
|
|
6243
6278
|
const identifier = typeof r.declared.Identifier === "string" ? r.declared.Identifier : r.physicalId;
|
|
6244
6279
|
if (identifier) declaredResourceServerIdentifiers.push(identifier);
|
|
6245
6280
|
}
|
|
@@ -6384,16 +6419,18 @@ async function enumerateGraphQLApiChildren(ctx) {
|
|
|
6384
6419
|
for (const r of desired.resources) {
|
|
6385
6420
|
if (r.resourceType !== "AWS::AppSync::DataSource" || typeof r.declared.Name !== "string") continue;
|
|
6386
6421
|
const declaredApiId = r.declared.ApiId;
|
|
6387
|
-
if (
|
|
6388
|
-
|
|
6422
|
+
if (declaredApiId !== UNRESOLVED && !hasUnresolved(declaredApiId)) {
|
|
6423
|
+
if (typeof declaredApiId !== "string" || bareApiId(declaredApiId) !== apiId) continue;
|
|
6424
|
+
}
|
|
6389
6425
|
declaredDataSourceNames.push(r.declared.Name);
|
|
6390
6426
|
}
|
|
6391
6427
|
const declaredResolverKeys = [];
|
|
6392
6428
|
for (const r of desired.resources) {
|
|
6393
6429
|
if (r.resourceType !== "AWS::AppSync::Resolver") continue;
|
|
6394
6430
|
const declaredApiId = r.declared.ApiId;
|
|
6395
|
-
if (
|
|
6396
|
-
|
|
6431
|
+
if (declaredApiId !== UNRESOLVED && !hasUnresolved(declaredApiId)) {
|
|
6432
|
+
if (typeof declaredApiId !== "string" || bareApiId(declaredApiId) !== apiId) continue;
|
|
6433
|
+
}
|
|
6397
6434
|
const { TypeName, FieldName } = r.declared;
|
|
6398
6435
|
if (typeof TypeName !== "string" || typeof FieldName !== "string") continue;
|
|
6399
6436
|
declaredResolverKeys.push(`${TypeName}|${FieldName}`);
|
|
@@ -6402,8 +6439,9 @@ async function enumerateGraphQLApiChildren(ctx) {
|
|
|
6402
6439
|
for (const r of desired.resources) {
|
|
6403
6440
|
if (r.resourceType !== "AWS::AppSync::FunctionConfiguration" || !r.physicalId) continue;
|
|
6404
6441
|
const declaredApiId = r.declared.ApiId;
|
|
6405
|
-
if (
|
|
6406
|
-
|
|
6442
|
+
if (declaredApiId !== UNRESOLVED && !hasUnresolved(declaredApiId)) {
|
|
6443
|
+
if (typeof declaredApiId !== "string" || bareApiId(declaredApiId) !== apiId) continue;
|
|
6444
|
+
}
|
|
6407
6445
|
declaredFunctionArns.push(r.physicalId);
|
|
6408
6446
|
}
|
|
6409
6447
|
const client = new AppSyncClient({
|
|
@@ -6501,13 +6539,13 @@ async function enumerateLogGroupChildren(ctx) {
|
|
|
6501
6539
|
if (!logGroupName) return [];
|
|
6502
6540
|
const declaredFilterNames = [];
|
|
6503
6541
|
for (const r of desired.resources) {
|
|
6504
|
-
if (r.resourceType !== "AWS::Logs::MetricFilter" || r.declared.LogGroupName
|
|
6542
|
+
if (r.resourceType !== "AWS::Logs::MetricFilter" || !parentRefMatches(r.declared.LogGroupName, logGroupName)) continue;
|
|
6505
6543
|
const name = typeof r.declared.FilterName === "string" ? r.declared.FilterName : r.physicalId;
|
|
6506
6544
|
if (name) declaredFilterNames.push(name);
|
|
6507
6545
|
}
|
|
6508
6546
|
const declaredSubscriptionNames = [];
|
|
6509
6547
|
for (const r of desired.resources) {
|
|
6510
|
-
if (r.resourceType !== "AWS::Logs::SubscriptionFilter" || r.declared.LogGroupName
|
|
6548
|
+
if (r.resourceType !== "AWS::Logs::SubscriptionFilter" || !parentRefMatches(r.declared.LogGroupName, logGroupName)) continue;
|
|
6511
6549
|
const name = typeof r.declared.FilterName === "string" ? r.declared.FilterName : r.physicalId;
|
|
6512
6550
|
if (name) declaredSubscriptionNames.push(name);
|
|
6513
6551
|
}
|
|
@@ -6559,7 +6597,7 @@ async function enumerateLoadBalancerChildren(ctx) {
|
|
|
6559
6597
|
const lbArn = parent.physicalId;
|
|
6560
6598
|
if (!lbArn) return [];
|
|
6561
6599
|
const declaredListenerArns = [];
|
|
6562
|
-
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);
|
|
6563
6601
|
return diffLoadBalancerChildren({
|
|
6564
6602
|
declaredListenerArns,
|
|
6565
6603
|
liveListeners: (await pageListeners(new ElasticLoadBalancingV2Client({
|
|
@@ -6603,7 +6641,7 @@ async function enumerateListenerChildren(ctx) {
|
|
|
6603
6641
|
const listenerArn = parent.physicalId;
|
|
6604
6642
|
if (!listenerArn) return [];
|
|
6605
6643
|
const declaredRuleArns = [];
|
|
6606
|
-
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);
|
|
6607
6645
|
return diffListenerChildren({
|
|
6608
6646
|
declaredRuleArns,
|
|
6609
6647
|
liveRules: (await pageListenerRules(new ElasticLoadBalancingV2Client({
|
|
@@ -6650,7 +6688,7 @@ async function enumerateVpcChildren(ctx) {
|
|
|
6650
6688
|
const vpcId = parent.physicalId;
|
|
6651
6689
|
if (!vpcId) return [];
|
|
6652
6690
|
const declaredSubnetIds = [];
|
|
6653
|
-
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);
|
|
6654
6692
|
return diffVpcChildren({
|
|
6655
6693
|
declaredSubnetIds,
|
|
6656
6694
|
liveSubnets: (await pageSubnets(new EC2Client({
|
|
@@ -6691,7 +6729,7 @@ async function enumerateRouteTableChildren(ctx) {
|
|
|
6691
6729
|
const routeTableId = parent.physicalId;
|
|
6692
6730
|
if (!routeTableId) return [];
|
|
6693
6731
|
const declaredCidrs = [];
|
|
6694
|
-
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);
|
|
6695
6733
|
return diffRouteTableChildren({
|
|
6696
6734
|
routeTableId,
|
|
6697
6735
|
declaredCidrs,
|
|
@@ -6739,7 +6777,7 @@ async function enumerateEcsClusterChildren(ctx) {
|
|
|
6739
6777
|
for (const r of desired.resources) {
|
|
6740
6778
|
if (r.resourceType !== "AWS::ECS::Service" || !r.physicalId) continue;
|
|
6741
6779
|
const decl = r.declared.Cluster;
|
|
6742
|
-
if (decl
|
|
6780
|
+
if (parentRefMatches(decl, cluster, clusterArn)) declaredServiceArns.push(r.physicalId);
|
|
6743
6781
|
}
|
|
6744
6782
|
return diffEcsClusterChildren({
|
|
6745
6783
|
cluster,
|
|
@@ -6790,7 +6828,7 @@ async function enumerateKmsKeyChildren(ctx) {
|
|
|
6790
6828
|
for (const r of desired.resources) {
|
|
6791
6829
|
if (r.resourceType !== "AWS::KMS::Alias") continue;
|
|
6792
6830
|
const target = r.declared.TargetKeyId;
|
|
6793
|
-
if (
|
|
6831
|
+
if (!parentRefMatches(target, keyId, keyArn)) continue;
|
|
6794
6832
|
const name = typeof r.declared.AliasName === "string" ? r.declared.AliasName : r.physicalId;
|
|
6795
6833
|
if (name) declaredAliasNames.push(name);
|
|
6796
6834
|
}
|
|
@@ -6870,8 +6908,8 @@ async function enumerateAppConfigApplicationChildren(ctx) {
|
|
|
6870
6908
|
if (!applicationId) return [];
|
|
6871
6909
|
const declaredEnvironmentIds = [];
|
|
6872
6910
|
const declaredProfileIds = [];
|
|
6873
|
-
for (const r of desired.resources) if (r.resourceType === "AWS::AppConfig::Environment" && r.declared.ApplicationId
|
|
6874
|
-
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);
|
|
6875
6913
|
const client = new AppConfigClient({
|
|
6876
6914
|
region,
|
|
6877
6915
|
...READ_RETRY
|
|
@@ -6926,7 +6964,7 @@ async function enumerateEfsFileSystemChildren(ctx) {
|
|
|
6926
6964
|
const fileSystemId = parent.physicalId;
|
|
6927
6965
|
if (!fileSystemId) return [];
|
|
6928
6966
|
const declaredMountTargetIds = [];
|
|
6929
|
-
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);
|
|
6930
6968
|
return diffEfsFileSystemChildren({
|
|
6931
6969
|
declaredMountTargetIds,
|
|
6932
6970
|
liveMountTargets: (await pageMountTargets(new EFSClient({
|
|
@@ -6977,7 +7015,7 @@ async function enumerateRdsClusterChildren(ctx) {
|
|
|
6977
7015
|
const clusterId = parent.physicalId;
|
|
6978
7016
|
if (!clusterId) return [];
|
|
6979
7017
|
const declaredInstanceIds = [];
|
|
6980
|
-
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);
|
|
6981
7019
|
const client = new RDSClient({
|
|
6982
7020
|
region,
|
|
6983
7021
|
...READ_RETRY
|
|
@@ -8488,190 +8526,186 @@ const supplementLexBot = async ({ physicalId, region }) => {
|
|
|
8488
8526
|
region,
|
|
8489
8527
|
...READ_RETRY
|
|
8490
8528
|
});
|
|
8491
|
-
|
|
8492
|
-
|
|
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 = [];
|
|
8493
8564
|
{
|
|
8494
8565
|
let nextToken;
|
|
8495
8566
|
do {
|
|
8496
|
-
const r = await c.send(new
|
|
8567
|
+
const r = await c.send(new ListSlotTypesCommand({
|
|
8497
8568
|
botId,
|
|
8498
8569
|
botVersion,
|
|
8570
|
+
localeId,
|
|
8499
8571
|
...nextToken && { nextToken }
|
|
8500
8572
|
}));
|
|
8501
|
-
|
|
8573
|
+
slotTypeSummaries.push(...r.slotTypeSummaries ?? []);
|
|
8502
8574
|
nextToken = r.nextToken;
|
|
8503
8575
|
} while (nextToken);
|
|
8504
8576
|
}
|
|
8505
|
-
const
|
|
8506
|
-
for (const
|
|
8507
|
-
const
|
|
8508
|
-
if (!
|
|
8509
|
-
|
|
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({
|
|
8510
8586
|
botId,
|
|
8511
8587
|
botVersion,
|
|
8512
|
-
localeId
|
|
8588
|
+
localeId,
|
|
8589
|
+
slotTypeId
|
|
8513
8590
|
}));
|
|
8514
|
-
const
|
|
8515
|
-
|
|
8516
|
-
|
|
8517
|
-
if (
|
|
8518
|
-
const
|
|
8519
|
-
if (
|
|
8520
|
-
|
|
8521
|
-
const
|
|
8522
|
-
|
|
8523
|
-
|
|
8524
|
-
|
|
8525
|
-
|
|
8526
|
-
|
|
8527
|
-
{
|
|
8528
|
-
let nextToken;
|
|
8529
|
-
do {
|
|
8530
|
-
const r = await c.send(new ListSlotTypesCommand({
|
|
8531
|
-
botId,
|
|
8532
|
-
botVersion,
|
|
8533
|
-
localeId,
|
|
8534
|
-
...nextToken && { nextToken }
|
|
8535
|
-
}));
|
|
8536
|
-
slotTypeSummaries.push(...r.slotTypeSummaries ?? []);
|
|
8537
|
-
nextToken = r.nextToken;
|
|
8538
|
-
} while (nextToken);
|
|
8539
|
-
}
|
|
8540
|
-
const cfnSlotTypes = [];
|
|
8541
|
-
for (const sts of slotTypeSummaries) {
|
|
8542
|
-
const slotTypeId = str$1(sts.slotTypeId);
|
|
8543
|
-
if (!slotTypeId) continue;
|
|
8544
|
-
if (slotTypeId.startsWith("AMAZON.")) {
|
|
8545
|
-
slotTypeNames.set(slotTypeId, slotTypeId);
|
|
8546
|
-
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;
|
|
8547
8604
|
}
|
|
8548
|
-
|
|
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({
|
|
8549
8616
|
botId,
|
|
8550
8617
|
botVersion,
|
|
8551
8618
|
localeId,
|
|
8552
|
-
|
|
8619
|
+
...nextToken && { nextToken }
|
|
8553
8620
|
}));
|
|
8554
|
-
|
|
8555
|
-
|
|
8556
|
-
|
|
8557
|
-
|
|
8558
|
-
|
|
8559
|
-
|
|
8560
|
-
|
|
8561
|
-
|
|
8562
|
-
|
|
8563
|
-
|
|
8564
|
-
|
|
8565
|
-
|
|
8566
|
-
|
|
8567
|
-
|
|
8568
|
-
|
|
8569
|
-
|
|
8570
|
-
|
|
8571
|
-
|
|
8572
|
-
|
|
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;
|
|
8573
8645
|
}
|
|
8574
|
-
const
|
|
8646
|
+
const slotNames = /* @__PURE__ */ new Map();
|
|
8647
|
+
const cfnSlots = [];
|
|
8648
|
+
const slotSummaries = [];
|
|
8575
8649
|
{
|
|
8576
8650
|
let nextToken;
|
|
8577
8651
|
do {
|
|
8578
|
-
const r = await c.send(new
|
|
8652
|
+
const r = await c.send(new ListSlotsCommand({
|
|
8579
8653
|
botId,
|
|
8580
8654
|
botVersion,
|
|
8581
8655
|
localeId,
|
|
8656
|
+
intentId,
|
|
8582
8657
|
...nextToken && { nextToken }
|
|
8583
8658
|
}));
|
|
8584
|
-
|
|
8659
|
+
slotSummaries.push(...r.slotSummaries ?? []);
|
|
8585
8660
|
nextToken = r.nextToken;
|
|
8586
8661
|
} while (nextToken);
|
|
8587
8662
|
}
|
|
8588
|
-
const
|
|
8589
|
-
|
|
8590
|
-
|
|
8591
|
-
|
|
8592
|
-
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({
|
|
8593
8667
|
botId,
|
|
8594
8668
|
botVersion,
|
|
8595
8669
|
localeId,
|
|
8596
|
-
intentId
|
|
8670
|
+
intentId,
|
|
8671
|
+
slotId
|
|
8597
8672
|
}));
|
|
8598
|
-
const
|
|
8599
|
-
|
|
8600
|
-
|
|
8601
|
-
|
|
8602
|
-
|
|
8603
|
-
|
|
8604
|
-
|
|
8605
|
-
if (
|
|
8606
|
-
const
|
|
8607
|
-
|
|
8608
|
-
|
|
8609
|
-
|
|
8610
|
-
|
|
8611
|
-
|
|
8612
|
-
{
|
|
8613
|
-
let nextToken;
|
|
8614
|
-
do {
|
|
8615
|
-
const r = await c.send(new ListSlotsCommand({
|
|
8616
|
-
botId,
|
|
8617
|
-
botVersion,
|
|
8618
|
-
localeId,
|
|
8619
|
-
intentId,
|
|
8620
|
-
...nextToken && { nextToken }
|
|
8621
|
-
}));
|
|
8622
|
-
slotSummaries.push(...r.slotSummaries ?? []);
|
|
8623
|
-
nextToken = r.nextToken;
|
|
8624
|
-
} while (nextToken);
|
|
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;
|
|
8625
8687
|
}
|
|
8626
|
-
|
|
8627
|
-
|
|
8628
|
-
|
|
8629
|
-
|
|
8630
|
-
|
|
8631
|
-
|
|
8632
|
-
|
|
8633
|
-
|
|
8634
|
-
|
|
8635
|
-
}
|
|
8636
|
-
|
|
8637
|
-
|
|
8638
|
-
const cfnSlot = {};
|
|
8639
|
-
if (slotName !== void 0) cfnSlot.Name = slotName;
|
|
8640
|
-
const slotTypeId = str$1(slot.slotTypeId);
|
|
8641
|
-
if (slotTypeId !== void 0) cfnSlot.SlotTypeName = slotTypeNames.get(slotTypeId) ?? slotTypeId;
|
|
8642
|
-
const elic = slot.valueElicitationSetting;
|
|
8643
|
-
if (elic && typeof elic === "object") {
|
|
8644
|
-
const cfnElic = {};
|
|
8645
|
-
const constraint = str$1(elic.slotConstraint);
|
|
8646
|
-
if (constraint !== void 0) cfnElic.SlotConstraint = constraint;
|
|
8647
|
-
const prompt = projectLexPrompt(elic.promptSpecification);
|
|
8648
|
-
if (prompt !== void 0) cfnElic.PromptSpecification = prompt;
|
|
8649
|
-
if (Object.keys(cfnElic).length > 0) cfnSlot.ValueElicitationSetting = cfnElic;
|
|
8650
|
-
}
|
|
8651
|
-
cfnSlots.push(cfnSlot);
|
|
8652
|
-
}
|
|
8653
|
-
if (Array.isArray(intent.slotPriorities)) {
|
|
8654
|
-
const priorities = intent.slotPriorities.map((p) => {
|
|
8655
|
-
const slotName = str$1(p.slotId) ? slotNames.get(str$1(p.slotId)) : void 0;
|
|
8656
|
-
if (typeof p.priority !== "number" || slotName === void 0) return void 0;
|
|
8657
|
-
return {
|
|
8658
|
-
Priority: p.priority,
|
|
8659
|
-
SlotName: slotName
|
|
8660
|
-
};
|
|
8661
|
-
}).filter((x) => x !== void 0);
|
|
8662
|
-
if (priorities.length > 0) cfnIntent.SlotPriorities = priorities;
|
|
8663
|
-
}
|
|
8664
|
-
if (cfnSlots.length > 0) cfnIntent.Slots = cfnSlots;
|
|
8665
|
-
cfnIntents.push(cfnIntent);
|
|
8688
|
+
cfnSlots.push(cfnSlot);
|
|
8689
|
+
}
|
|
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;
|
|
8666
8700
|
}
|
|
8667
|
-
if (
|
|
8668
|
-
|
|
8669
|
-
botLocales.push(cfnLocale);
|
|
8701
|
+
if (cfnSlots.length > 0) cfnIntent.Slots = cfnSlots;
|
|
8702
|
+
cfnIntents.push(cfnIntent);
|
|
8670
8703
|
}
|
|
8671
|
-
|
|
8672
|
-
|
|
8673
|
-
|
|
8704
|
+
if (cfnSlotTypes.length > 0) cfnLocale.SlotTypes = cfnSlotTypes;
|
|
8705
|
+
if (cfnIntents.length > 0) cfnLocale.Intents = cfnIntents;
|
|
8706
|
+
botLocales.push(cfnLocale);
|
|
8674
8707
|
}
|
|
8708
|
+
return botLocales.length > 0 ? { BotLocales: botLocales } : void 0;
|
|
8675
8709
|
};
|
|
8676
8710
|
const supplementElasticBeanstalkEnvironment = async ({ physicalId, declared, region }) => {
|
|
8677
8711
|
const envName = str$1(physicalId);
|
|
@@ -9123,6 +9157,7 @@ function liveModelMap(reads) {
|
|
|
9123
9157
|
return out;
|
|
9124
9158
|
}
|
|
9125
9159
|
const kmsDeniedWarned = /* @__PURE__ */ new Set();
|
|
9160
|
+
const kmsTransientWarned = /* @__PURE__ */ new Set();
|
|
9126
9161
|
const POOL_SIZE = 6;
|
|
9127
9162
|
async function readAll(cc, targets, region, desired, reads) {
|
|
9128
9163
|
let cursor = 0;
|
|
@@ -9374,10 +9409,10 @@ async function gatherFindings(stackName, region, templateOverride, recoveryTempl
|
|
|
9374
9409
|
if (desired.resources.some((r) => usesManagedKmsAlias(r.declared))) {
|
|
9375
9410
|
const resolved = await fetchManagedAliasTargets(region);
|
|
9376
9411
|
kmsAliasTargets = resolved.targets;
|
|
9377
|
-
|
|
9378
|
-
|
|
9379
|
-
|
|
9380
|
-
|
|
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);
|
|
9381
9416
|
}
|
|
9382
9417
|
const classifyOpts = {
|
|
9383
9418
|
accountId: desired.accountId,
|
|
@@ -11822,8 +11857,22 @@ function nullHuskRemovalOps(model) {
|
|
|
11822
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")}`);
|
|
11823
11858
|
};
|
|
11824
11859
|
walk(model, "");
|
|
11860
|
+
ops.sort((a, b) => compareDocOrderDescending(a.path, b.path));
|
|
11825
11861
|
return ops;
|
|
11826
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
|
+
}
|
|
11827
11876
|
function splitTopLevelDots(dotted) {
|
|
11828
11877
|
const out = [];
|
|
11829
11878
|
let cur = "";
|
|
@@ -14275,7 +14324,7 @@ async function runCheck(args) {
|
|
|
14275
14324
|
const baseline = a.showAll ? void 0 : await loadBaseline(stackName, desired.accountId, region);
|
|
14276
14325
|
if (baseline) checkBaselineAccount(baseline, desired.accountId, stackName);
|
|
14277
14326
|
if (baseline) warnTemplateHashDrift(baseline, desired.rawTemplate, stackName);
|
|
14278
|
-
if (baseline
|
|
14327
|
+
if (baseline) warnBaselineSchemaV1(baseline, stackName);
|
|
14279
14328
|
const reconciled = applyIgnores(reconcileBaseline(findings, baseline, {
|
|
14280
14329
|
declaredOnly: a.declaredOnly,
|
|
14281
14330
|
applyOpts: {
|