cdk-real-drift 0.3.10 → 0.3.12
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 +268 -205
- 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
|
-
|
|
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;
|
|
8608
8687
|
}
|
|
8609
|
-
|
|
8610
|
-
const cfnSlots = [];
|
|
8611
|
-
const slotSummaries = [];
|
|
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);
|
|
8625
|
-
}
|
|
8626
|
-
for (const ss of slotSummaries) {
|
|
8627
|
-
const slotId = str$1(ss.slotId);
|
|
8628
|
-
if (!slotId) continue;
|
|
8629
|
-
const slot = await c.send(new DescribeSlotCommand({
|
|
8630
|
-
botId,
|
|
8631
|
-
botVersion,
|
|
8632
|
-
localeId,
|
|
8633
|
-
intentId,
|
|
8634
|
-
slotId
|
|
8635
|
-
}));
|
|
8636
|
-
const slotName = str$1(slot.slotName);
|
|
8637
|
-
if (slotName !== void 0) slotNames.set(slotId, slotName);
|
|
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);
|
|
8666
8689
|
}
|
|
8667
|
-
if (
|
|
8668
|
-
|
|
8669
|
-
|
|
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);
|
|
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 = "";
|
|
@@ -12368,14 +12417,26 @@ const driftCount = (findings) => findings.filter(isDrift).length;
|
|
|
12368
12417
|
const unrecordedCount = (findings) => findings.filter((f) => f.unrecorded === true).length;
|
|
12369
12418
|
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
12370
12419
|
/**
|
|
12420
|
+
* The per-stack label shown in a DECISION prompt — the SAME `Name (region)` form the
|
|
12421
|
+
* report header uses (`check.ts` `${stackName} (${region})`). After #899 exact-name
|
|
12422
|
+
* selection targets EVERY same-named region instance, so a bare `stackName` in a
|
|
12423
|
+
* record/ignore/revert prompt is indistinguishable across regions (a wrong-region
|
|
12424
|
+
* record/ignore/revert hazard, #947). Naming the region disambiguates them. Pure +
|
|
12425
|
+
* exported so the wording is unit-tested.
|
|
12426
|
+
*/
|
|
12427
|
+
function stackLabel$1(stackName, region) {
|
|
12428
|
+
return `${stackName} (${region})`;
|
|
12429
|
+
}
|
|
12430
|
+
/**
|
|
12371
12431
|
* The revert confirm message (R52). When NOT-revertable findings exist (e.g. a
|
|
12372
12432
|
* no-baseline first check with one declared drift and 100+ undeclared values),
|
|
12373
12433
|
* users read "This WRITES to AWS" as "everything I just saw gets written" —
|
|
12374
12434
|
* state explicitly that ONLY the listed op(s) are written and the rest is
|
|
12375
12435
|
* untouched. Pure + exported so the wording is unit-tested.
|
|
12376
12436
|
*/
|
|
12377
|
-
function revertConfirmMessage(stackName, opCount, notRevertableCount) {
|
|
12378
|
-
|
|
12437
|
+
function revertConfirmMessage(stackName, region, opCount, notRevertableCount) {
|
|
12438
|
+
const scope = notRevertableCount > 0 ? ` Only the ${opCount} selected op(s) are written — the ${notRevertableCount} NOT-revertable finding(s) are untouched.` : "";
|
|
12439
|
+
return `Apply ${opCount} revert op(s) to ${stackLabel$1(stackName, region)}? This WRITES to AWS.${scope}`;
|
|
12379
12440
|
}
|
|
12380
12441
|
/**
|
|
12381
12442
|
* The post-revert surviving-drift pointer list (R46), capped (R52): after a
|
|
@@ -12399,8 +12460,9 @@ function formatSurvivingDrift(remaining, stackName = "", cap = 10) {
|
|
|
12399
12460
|
* (the folded would just nag forever), whereas deselecting a standout to "record the rest"
|
|
12400
12461
|
* IS useful — so standouts toggle, the folded always record. Pure + exported.
|
|
12401
12462
|
*/
|
|
12402
|
-
function recordSelectMessage(stackName, foldedCount = 0) {
|
|
12403
|
-
|
|
12463
|
+
function recordSelectMessage(stackName, region, foldedCount = 0) {
|
|
12464
|
+
const fold = foldedCount > 0 ? `; +${foldedCount} folded sub-key(s) ALWAYS recorded too (--verbose to itemize)` : "";
|
|
12465
|
+
return `${stackLabel$1(stackName, region)}: select undeclared value(s) to record (unselected stay reported)${fold}`;
|
|
12404
12466
|
}
|
|
12405
12467
|
/**
|
|
12406
12468
|
* Split the to-record delta into STANDOUT (itemized in the record multiselect) and FOLDED
|
|
@@ -12491,8 +12553,8 @@ function filterRevertPlan(plan, picked) {
|
|
|
12491
12553
|
notRevertable: plan.notRevertable
|
|
12492
12554
|
};
|
|
12493
12555
|
}
|
|
12494
|
-
function revertSelectMessage(stackName) {
|
|
12495
|
-
return `${stackName}: select the op(s) to revert (unselected are not written)`;
|
|
12556
|
+
function revertSelectMessage(stackName, region) {
|
|
12557
|
+
return `${stackLabel$1(stackName, region)}: select the op(s) to revert (unselected are not written)`;
|
|
12496
12558
|
}
|
|
12497
12559
|
/**
|
|
12498
12560
|
* Record the current undeclared state into the baseline file. In an interactive run
|
|
@@ -12510,7 +12572,7 @@ async function recordStack(p) {
|
|
|
12510
12572
|
const { stackName, region, desired, findings, yes, interactive, preselectedKeys, expandNested } = p;
|
|
12511
12573
|
const existing = await loadBaseline(stackName, desired.accountId, region);
|
|
12512
12574
|
if (existing) checkBaselineAccount(existing, desired.accountId, stackName);
|
|
12513
|
-
if (!yes && existing) console.error(`note: ${stackName}: will overwrite the existing baseline file on confirm (nothing written yet; it is git-tracked — review the diff afterwards). Pass --yes to silence.`);
|
|
12575
|
+
if (!yes && existing) console.error(`note: ${stackLabel$1(stackName, region)}: will overwrite the existing baseline file on confirm (nothing written yet; it is git-tracked — review the diff afterwards). Pass --yes to silence.`);
|
|
12514
12576
|
let recorded = carryForwardUnreadable(buildRecorded(findings), existing, findings);
|
|
12515
12577
|
let refreshedOnly = false;
|
|
12516
12578
|
if (!yes && recorded.length > 0) {
|
|
@@ -12533,7 +12595,7 @@ async function recordStack(p) {
|
|
|
12533
12595
|
const { standout, folded } = splitFoldedNested(changed, findings, expandNested);
|
|
12534
12596
|
if (standout.length === 0) {
|
|
12535
12597
|
const proceed = await confirm({
|
|
12536
|
-
message: `${stackName}: record ${folded.length} undeclared sub-key value(s)? (--verbose to itemize each)`,
|
|
12598
|
+
message: `${stackLabel$1(stackName, region)}: record ${folded.length} undeclared sub-key value(s)? (--verbose to itemize each)`,
|
|
12537
12599
|
initialValue: true
|
|
12538
12600
|
});
|
|
12539
12601
|
if (isCancel(proceed) || !proceed) {
|
|
@@ -12545,7 +12607,7 @@ async function recordStack(p) {
|
|
|
12545
12607
|
}
|
|
12546
12608
|
picked = changed.map((e) => recordedKey(e));
|
|
12547
12609
|
} else {
|
|
12548
|
-
const fromPrompt = await bulkMultiselect(recordSelectMessage(stackName, folded.length), standout.map((e) => ({
|
|
12610
|
+
const fromPrompt = await bulkMultiselect(recordSelectMessage(stackName, region, folded.length), standout.map((e) => ({
|
|
12549
12611
|
value: recordedKey(e),
|
|
12550
12612
|
label: e.path ? `${e.logicalId}.${e.path}` : `${e.logicalId} (added resource)`,
|
|
12551
12613
|
selected: true
|
|
@@ -12564,7 +12626,7 @@ async function recordStack(p) {
|
|
|
12564
12626
|
recorded = [...unchanged, ...selectedChanged];
|
|
12565
12627
|
if (recorded.length === 0 && !preselectedKeys) {
|
|
12566
12628
|
const proceed = await confirm({
|
|
12567
|
-
message: `${stackName}: record nothing? This writes an EMPTY baseline — every undeclared value stays reported as unrecorded.`,
|
|
12629
|
+
message: `${stackLabel$1(stackName, region)}: record nothing? This writes an EMPTY baseline — every undeclared value stays reported as unrecorded.`,
|
|
12568
12630
|
initialValue: false
|
|
12569
12631
|
});
|
|
12570
12632
|
if (isCancel(proceed) || !proceed) {
|
|
@@ -12594,8 +12656,8 @@ async function recordStack(p) {
|
|
|
12594
12656
|
}
|
|
12595
12657
|
/** Header for ignore's multiselect. The key hints are rendered by `bulkMultiselect`
|
|
12596
12658
|
* itself, so this is just the one-line prompt. Pure + exported for unit tests. */
|
|
12597
|
-
function ignoreSelectMessage(stackName) {
|
|
12598
|
-
return `${stackName}: select drift to ignore — stops reporting it (writes .cdkrd/ignore.yaml)`;
|
|
12659
|
+
function ignoreSelectMessage(stackName, region) {
|
|
12660
|
+
return `${stackLabel$1(stackName, region)}: select drift to ignore — stops reporting it (writes .cdkrd/ignore.yaml)`;
|
|
12599
12661
|
}
|
|
12600
12662
|
const ignoreFindingKey = (f) => `${f.logicalId}::${f.path}`;
|
|
12601
12663
|
/**
|
|
@@ -12646,7 +12708,7 @@ async function ignoreStack(p) {
|
|
|
12646
12708
|
added: 0
|
|
12647
12709
|
};
|
|
12648
12710
|
}
|
|
12649
|
-
const picked = await bulkMultiselect(ignoreSelectMessage(stackName), ignoreSelectOptions(ignorable, stackName));
|
|
12711
|
+
const picked = await bulkMultiselect(ignoreSelectMessage(stackName, region), ignoreSelectOptions(ignorable, stackName));
|
|
12650
12712
|
if (picked === void 0) {
|
|
12651
12713
|
console.error(`note: ${stackName}: ignore cancelled — config unchanged`);
|
|
12652
12714
|
return {
|
|
@@ -12824,7 +12886,7 @@ async function revertStack(p) {
|
|
|
12824
12886
|
};
|
|
12825
12887
|
}
|
|
12826
12888
|
if (!autoSelectAll) {
|
|
12827
|
-
const picked = await bulkMultiselect(revertSelectMessage(stackName), revertSelectOptions(plan));
|
|
12889
|
+
const picked = await bulkMultiselect(revertSelectMessage(stackName, region), revertSelectOptions(plan));
|
|
12828
12890
|
if (picked === void 0) {
|
|
12829
12891
|
out(style.note("aborted."));
|
|
12830
12892
|
return {
|
|
@@ -12841,7 +12903,7 @@ async function revertStack(p) {
|
|
|
12841
12903
|
};
|
|
12842
12904
|
}
|
|
12843
12905
|
}
|
|
12844
|
-
const ok = await confirm({ message: revertConfirmMessage(stackName, plan.items.reduce((n, i) => n + i.ops.length, 0), plan.notRevertable.length) });
|
|
12906
|
+
const ok = await confirm({ message: revertConfirmMessage(stackName, region, plan.items.reduce((n, i) => n + i.ops.length, 0), plan.notRevertable.length) });
|
|
12845
12907
|
if (isCancel(ok) || !ok) {
|
|
12846
12908
|
out(style.note("aborted."));
|
|
12847
12909
|
return {
|
|
@@ -13858,9 +13920,10 @@ function buildResolveOptions(actions, decidableCount, recordLabel = "snapshot")
|
|
|
13858
13920
|
/** The top-menu prompt, worded by the remaining exit state (drift vs unrecorded-only vs
|
|
13859
13921
|
* R141 no-baseline establish). `prefix` carries the `[2/3] ` multi-stack position cue
|
|
13860
13922
|
* (issue #539) — empty for a lone stack. Pure + exported. */
|
|
13861
|
-
function resolveMenuMessage(stackName, code, establishOnly = false, prefix = "") {
|
|
13862
|
-
|
|
13863
|
-
|
|
13923
|
+
function resolveMenuMessage(stackName, region, code, establishOnly = false, prefix = "") {
|
|
13924
|
+
const label = stackLabel$1(stackName, region);
|
|
13925
|
+
if (establishOnly) return `${prefix}${label}: no .cdkrd baseline yet — record the current state as your baseline?`;
|
|
13926
|
+
return code === 1 ? `${prefix}${label}: drift found — what do you want to do?` : `${prefix}${label}: potential drift found (live-only, no baseline yet) — what do you want to do?`;
|
|
13864
13927
|
}
|
|
13865
13928
|
async function resolveInteractively(p) {
|
|
13866
13929
|
const opts = baselineOpts(p);
|
|
@@ -13880,7 +13943,7 @@ async function resolveInteractively(p) {
|
|
|
13880
13943
|
const recordLabel = recordable ? "snapshot" : declaredDrift ? "establish-drift" : deletedDrift ? "establish-deleted" : "establish";
|
|
13881
13944
|
const options = buildResolveOptions(actions, decidable.length, recordLabel);
|
|
13882
13945
|
const choice = await select({
|
|
13883
|
-
message: resolveMenuMessage(p.stackName, code, establishOnly, p.positionPrefix ?? ""),
|
|
13946
|
+
message: resolveMenuMessage(p.stackName, p.region, code, establishOnly, p.positionPrefix ?? ""),
|
|
13884
13947
|
options,
|
|
13885
13948
|
initialValue: "nothing"
|
|
13886
13949
|
});
|
|
@@ -14275,7 +14338,7 @@ async function runCheck(args) {
|
|
|
14275
14338
|
const baseline = a.showAll ? void 0 : await loadBaseline(stackName, desired.accountId, region);
|
|
14276
14339
|
if (baseline) checkBaselineAccount(baseline, desired.accountId, stackName);
|
|
14277
14340
|
if (baseline) warnTemplateHashDrift(baseline, desired.rawTemplate, stackName);
|
|
14278
|
-
if (baseline
|
|
14341
|
+
if (baseline) warnBaselineSchemaV1(baseline, stackName);
|
|
14279
14342
|
const reconciled = applyIgnores(reconcileBaseline(findings, baseline, {
|
|
14280
14343
|
declaredOnly: a.declaredOnly,
|
|
14281
14344
|
applyOpts: {
|