cdk-real-drift 0.25.1 → 0.25.3
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 +6 -1
- package/dist/cli.js +185 -10
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -586,7 +586,12 @@ autoscaled DynamoDB capacity, a Lambda alias's provisioned concurrency, … —
|
|
|
586
586
|
flagged while its live value stays within the declared `MinCapacity`/`MaxCapacity`
|
|
587
587
|
band (the autoscaler enforcing the template's own delegation is intent, not drift,
|
|
588
588
|
#688). A value pushed _beyond_ the band still surfaces as real drift, but `revert`
|
|
589
|
-
deliberately refuses it (writing the initial value back would just be re-scaled).
|
|
589
|
+
deliberately refuses it (writing the initial value back would just be re-scaled). The
|
|
590
|
+
same treatment covers an ECS **blue/green** service's production/test listener rule:
|
|
591
|
+
the deployment controller rewrites its forward action to a weighted config over the
|
|
592
|
+
declared production/alternate target-group pair, which is not flagged while the live
|
|
593
|
+
targets stay within that pair — an out-of-band retarget to any other group still
|
|
594
|
+
surfaces, refused by `revert` for the same reason (#1730). For
|
|
590
595
|
anything cdkrd does not fold — an externally-managed Lambda **reserved** concurrency,
|
|
591
596
|
a value another controller rewrites — run **`cdkrd ignore`** to pick the drift to
|
|
592
597
|
suppress, or hand-edit the git-committed `.cdkrd/ignore.yaml`. It is a
|
package/dist/cli.js
CHANGED
|
@@ -30,7 +30,7 @@ import { DescribeMountTargetsCommand, EFSClient } from "@aws-sdk/client-efs";
|
|
|
30
30
|
import { DescribeApplicationVersionsCommand, DescribeApplicationsCommand, DescribeConfigurationSettingsCommand, ElasticBeanstalkClient, UpdateApplicationCommand, UpdateApplicationResourceLifecycleCommand, UpdateEnvironmentCommand } from "@aws-sdk/client-elastic-beanstalk";
|
|
31
31
|
import { DescribeListenerCertificatesCommand, DescribeListenersCommand, DescribeRulesCommand, ElasticLoadBalancingV2Client, GetTrustStoreCaCertificatesBundleCommand, ModifyLoadBalancerAttributesCommand, ModifyTargetGroupAttributesCommand } from "@aws-sdk/client-elastic-load-balancing-v2";
|
|
32
32
|
import { DescribeEventBusCommand, EventBridgeClient, ListRulesCommand, PutPermissionCommand } from "@aws-sdk/client-eventbridge";
|
|
33
|
-
import { GetClassifierCommand, GetConnectionCommand, GetJobCommand, GetSecurityConfigurationCommand, GetTableCommand, GetTablesCommand, GetTagsCommand, GetWorkflowCommand, GlueClient, UpdateClassifierCommand, UpdateConnectionCommand, UpdateJobCommand, UpdateTableCommand, UpdateWorkflowCommand } from "@aws-sdk/client-glue";
|
|
33
|
+
import { DeleteTableCommand, GetClassifierCommand, GetConnectionCommand, GetJobCommand, GetSecurityConfigurationCommand, GetTableCommand, GetTablesCommand, GetTagsCommand, GetWorkflowCommand, GlueClient, UpdateClassifierCommand, UpdateConnectionCommand, UpdateJobCommand, UpdateTableCommand, UpdateWorkflowCommand } from "@aws-sdk/client-glue";
|
|
34
34
|
import { GuardDutyClient, ListFiltersCommand, ListIPSetsCommand, ListPublishingDestinationsCommand, ListThreatEntitySetsCommand, ListThreatIntelSetsCommand, ListTrustedEntitySetsCommand } from "@aws-sdk/client-guardduty";
|
|
35
35
|
import { AddPermissionCommand, GetFunctionCommand, GetPolicyCommand, LambdaClient, ListAliasesCommand as ListAliasesCommand$1, ListEventSourceMappingsCommand, ListFunctionUrlConfigsCommand, ListVersionsByFunctionCommand, RemovePermissionCommand } from "@aws-sdk/client-lambda";
|
|
36
36
|
import { DescribeDomainConfigCommand, DescribeDomainsCommand, ListDomainNamesCommand, OpenSearchClient, UpdateDomainConfigCommand } from "@aws-sdk/client-opensearch";
|
|
@@ -1919,6 +1919,7 @@ function buildCorpusCase(resource, liveRaw, schema, opts, findings) {
|
|
|
1919
1919
|
const bucketNotif = resource.physicalId && opts.bucketNotificationManaged?.has(resource.physicalId) ? [resource.physicalId] : void 0;
|
|
1920
1920
|
const eipSiblingId = resource.physicalId && opts.siblingEipAssociations?.has(resource.physicalId) ? resource.physicalId : opts.siblingEipAssociations?.has(resource.logicalId) ? resource.logicalId : void 0;
|
|
1921
1921
|
const tgRegistrarId = resource.physicalId && opts.siblingTargetGroupRegistrars?.has(resource.physicalId) ? resource.physicalId : opts.siblingTargetGroupRegistrars?.has(resource.logicalId) ? resource.logicalId : void 0;
|
|
1922
|
+
const bgRuleKey = resource.resourceType === "AWS::ElasticLoadBalancingV2::ListenerRule" ? opts.ecsBgGovernedListenerRules?.[resource.logicalId] !== void 0 ? resource.logicalId : resource.physicalId && opts.ecsBgGovernedListenerRules?.[resource.physicalId] ? resource.physicalId : void 0 : void 0;
|
|
1922
1923
|
const subnetSiblingId = resource.physicalId && opts.siblingSubnetCidrBlocks?.has(resource.physicalId) ? resource.physicalId : opts.siblingSubnetCidrBlocks?.has(resource.logicalId) ? resource.logicalId : void 0;
|
|
1923
1924
|
const echoModel = resource.physicalId && opts.clusterEchoModel?.[resource.physicalId] ? opts.clusterEchoModel[resource.physicalId] : void 0;
|
|
1924
1925
|
const rdsOptCatalog = resource.physicalId && opts.rdsOptionSettingDefaults?.[resource.physicalId] ? opts.rdsOptionSettingDefaults[resource.physicalId] : void 0;
|
|
@@ -1971,6 +1972,7 @@ function buildCorpusCase(resource, liveRaw, schema, opts, findings) {
|
|
|
1971
1972
|
...eipSiblingId ? { siblingEipAssociations: [eipSiblingId] } : {},
|
|
1972
1973
|
...subnetSiblingId ? { siblingSubnetCidrBlocks: [subnetSiblingId] } : {},
|
|
1973
1974
|
...tgRegistrarId ? { siblingTargetGroupRegistrars: [tgRegistrarId] } : {},
|
|
1975
|
+
...bgRuleKey !== void 0 && opts.ecsBgGovernedListenerRules?.[bgRuleKey] ? { ecsBgGovernedListenerRules: { [bgRuleKey]: opts.ecsBgGovernedListenerRules[bgRuleKey] } } : {},
|
|
1974
1976
|
...echoModel && resource.physicalId ? { clusterEchoModel: { [resource.physicalId]: echoModel } } : {},
|
|
1975
1977
|
...rdsOptCatalog && resource.physicalId ? { rdsOptionSettingDefaults: { [resource.physicalId]: rdsOptCatalog } } : {},
|
|
1976
1978
|
...gaListenerPort ? { siblingListenerPorts: gaListenerPort } : {},
|
|
@@ -3212,6 +3214,8 @@ const KNOWN_DEFAULT_PATHS = {
|
|
|
3212
3214
|
"NetworkConfiguration.AwsvpcConfiguration.AssignPublicIp": "DISABLED",
|
|
3213
3215
|
"DeploymentConfiguration.Strategy": "ROLLING",
|
|
3214
3216
|
"DeploymentConfiguration.BakeTimeInMinutes": 0,
|
|
3217
|
+
"DeploymentConfiguration.MaximumPercent": 200,
|
|
3218
|
+
"DeploymentConfiguration.MinimumHealthyPercent": 100,
|
|
3215
3219
|
"DeploymentConfiguration.DeploymentCircuitBreaker.ResetOnHealthyTask": true,
|
|
3216
3220
|
"DeploymentConfiguration.DeploymentCircuitBreaker.ThresholdConfiguration": {
|
|
3217
3221
|
Type: "BOUNDED_PERCENT",
|
|
@@ -3227,6 +3231,7 @@ const KNOWN_DEFAULT_PATHS = {
|
|
|
3227
3231
|
Rollback: false
|
|
3228
3232
|
}
|
|
3229
3233
|
},
|
|
3234
|
+
"AWS::CloudFront::VpcOrigin": { "VpcOriginEndpointConfig.OriginSSLProtocols": ["SSLv3", "TLSv1"] },
|
|
3230
3235
|
"AWS::Bedrock::Guardrail": {
|
|
3231
3236
|
"ContentPolicyConfig.ContentFiltersTierConfig": { TierName: "CLASSIC" },
|
|
3232
3237
|
"TopicPolicyConfig.TopicsTierConfig": { TierName: "CLASSIC" }
|
|
@@ -4078,8 +4083,18 @@ const CASE_INSENSITIVE_PATHS = {
|
|
|
4078
4083
|
"DBSubnetGroupName"
|
|
4079
4084
|
]),
|
|
4080
4085
|
"AWS::ElastiCache::SubnetGroup": new Set(["CacheSubnetGroupName"]),
|
|
4081
|
-
"AWS::ElastiCache::ReplicationGroup": new Set([
|
|
4082
|
-
|
|
4086
|
+
"AWS::ElastiCache::ReplicationGroup": new Set([
|
|
4087
|
+
"ReplicationGroupId",
|
|
4088
|
+
"CacheSubnetGroupName",
|
|
4089
|
+
"CacheParameterGroupName"
|
|
4090
|
+
]),
|
|
4091
|
+
"AWS::ElastiCache::CacheCluster": new Set([
|
|
4092
|
+
"ClusterName",
|
|
4093
|
+
"CacheSubnetGroupName",
|
|
4094
|
+
"CacheParameterGroupName"
|
|
4095
|
+
]),
|
|
4096
|
+
"AWS::ElastiCache::ServerlessCache": new Set(["ServerlessCacheName", "UserGroupId"]),
|
|
4097
|
+
"AWS::Route53Resolver::ResolverRule": new Set(["DomainName"]),
|
|
4083
4098
|
"AWS::DocDB::DBCluster": new Set([
|
|
4084
4099
|
"DBClusterIdentifier",
|
|
4085
4100
|
"DBSubnetGroupName",
|
|
@@ -4116,6 +4131,11 @@ const CASE_INSENSITIVE_PATHS = {
|
|
|
4116
4131
|
"AWS::DMS::ReplicationSubnetGroup": new Set(["ReplicationSubnetGroupIdentifier"]),
|
|
4117
4132
|
"AWS::DAX::ParameterGroup": new Set(["ParameterGroupName"]),
|
|
4118
4133
|
"AWS::DAX::SubnetGroup": new Set(["SubnetGroupName"]),
|
|
4134
|
+
"AWS::DAX::Cluster": new Set([
|
|
4135
|
+
"ClusterName",
|
|
4136
|
+
"ParameterGroupName",
|
|
4137
|
+
"SubnetGroupName"
|
|
4138
|
+
]),
|
|
4119
4139
|
"AWS::CertificateManager::Certificate": new Set(["DomainName"]),
|
|
4120
4140
|
"AWS::DMS::Endpoint": new Set(["EndpointType", "EndpointIdentifier"]),
|
|
4121
4141
|
"AWS::WAFv2::LoggingConfiguration": new Set(["RedactedFields.*.SingleHeader.Name"]),
|
|
@@ -4318,7 +4338,9 @@ const CASE_INSENSITIVE_ARRAY_PATHS = {
|
|
|
4318
4338
|
"AWS::ApiGatewayV2::Api": new Set(["CorsConfiguration.AllowHeaders", "CorsConfiguration.ExposeHeaders"]),
|
|
4319
4339
|
"AWS::Lambda::Url": new Set(["Cors.AllowHeaders", "Cors.ExposeHeaders"]),
|
|
4320
4340
|
"AWS::CertificateManager::Certificate": new Set(["SubjectAlternativeNames"]),
|
|
4321
|
-
"AWS::SES::ConfigurationSetEventDestination": new Set(["EventDestination.MatchingEventTypes"])
|
|
4341
|
+
"AWS::SES::ConfigurationSetEventDestination": new Set(["EventDestination.MatchingEventTypes"]),
|
|
4342
|
+
"AWS::ElastiCache::UserGroup": new Set(["UserIds"]),
|
|
4343
|
+
"AWS::ElastiCache::ReplicationGroup": new Set(["UserGroupIds"])
|
|
4322
4344
|
};
|
|
4323
4345
|
function isCaseInsensitiveEqualScalarSet(a, b) {
|
|
4324
4346
|
if (!Array.isArray(a) || !Array.isArray(b) || a.length !== b.length) return false;
|
|
@@ -5529,6 +5551,9 @@ function elbTargetGroupDerivedHealthCheckProtocol(protocol, targetType) {
|
|
|
5529
5551
|
function elbTargetGroupDerivedHealthCheckPort(protocol) {
|
|
5530
5552
|
return protocol === "GENEVE" ? "80" : void 0;
|
|
5531
5553
|
}
|
|
5554
|
+
function logsDeliveryDerivedRetention(logGroupClass) {
|
|
5555
|
+
return logGroupClass === "DELIVERY" ? 2 : void 0;
|
|
5556
|
+
}
|
|
5532
5557
|
function rdsReplicaDerivedBackupRetention(sourceDbInstanceIdentifier) {
|
|
5533
5558
|
return sourceDbInstanceIdentifier !== void 0 ? 0 : void 0;
|
|
5534
5559
|
}
|
|
@@ -7092,6 +7117,41 @@ function applyAutoscalerBandFold(findings, bands) {
|
|
|
7092
7117
|
}
|
|
7093
7118
|
return out;
|
|
7094
7119
|
}
|
|
7120
|
+
function applyEcsBlueGreenListenerRuleFold(findings, allowedTgIds, liveRaw) {
|
|
7121
|
+
const liveTgArns = /* @__PURE__ */ new Set();
|
|
7122
|
+
const actions = liveRaw.Actions;
|
|
7123
|
+
if (Array.isArray(actions)) for (const a of actions) {
|
|
7124
|
+
if (!a || typeof a !== "object") continue;
|
|
7125
|
+
const ao = a;
|
|
7126
|
+
if (typeof ao.TargetGroupArn === "string") liveTgArns.add(ao.TargetGroupArn);
|
|
7127
|
+
const fc = ao.ForwardConfig;
|
|
7128
|
+
if (fc && typeof fc === "object") {
|
|
7129
|
+
const tgs = fc.TargetGroups;
|
|
7130
|
+
if (Array.isArray(tgs)) {
|
|
7131
|
+
for (const tg of tgs) if (tg && typeof tg === "object") {
|
|
7132
|
+
const arn = tg.TargetGroupArn;
|
|
7133
|
+
if (typeof arn === "string") liveTgArns.add(arn);
|
|
7134
|
+
}
|
|
7135
|
+
}
|
|
7136
|
+
}
|
|
7137
|
+
}
|
|
7138
|
+
const allowed = new Set(allowedTgIds);
|
|
7139
|
+
const withinAllowed = liveTgArns.size > 0 && [...liveTgArns].every((arn) => allowed.has(arn));
|
|
7140
|
+
const out = [];
|
|
7141
|
+
for (const f of findings) {
|
|
7142
|
+
if (!(f.tier === "declared" && /^Actions[.[]/.test(f.path) && (f.path.includes("TargetGroupArn") || f.path.includes("ForwardConfig")))) {
|
|
7143
|
+
out.push(f);
|
|
7144
|
+
continue;
|
|
7145
|
+
}
|
|
7146
|
+
if (withinAllowed) continue;
|
|
7147
|
+
out.push({
|
|
7148
|
+
...f,
|
|
7149
|
+
ecsBlueGreenGoverned: true,
|
|
7150
|
+
...f.hint === void 0 ? { hint: "governed by an ECS blue/green deployment (the service rewrites this listener rule's forward action, swinging weights between the production and alternate target groups); the live forward target is outside that declared pair, so this is a real change — but revert cannot converge (the deployment controller re-writes the rule). Update the service's AdvancedConfiguration, or record/ignore to accept" } : {}
|
|
7151
|
+
});
|
|
7152
|
+
}
|
|
7153
|
+
return out;
|
|
7154
|
+
}
|
|
7095
7155
|
function classifyResource(resource, liveRaw, schema, opts = {}) {
|
|
7096
7156
|
const { logicalId, resourceType, physicalId, declared: declaredIn } = resource;
|
|
7097
7157
|
const findings = [];
|
|
@@ -7418,6 +7478,13 @@ function classifyResource(resource, liveRaw, schema, opts = {}) {
|
|
|
7418
7478
|
"HealthCheckConfig.Port": defaultPort
|
|
7419
7479
|
};
|
|
7420
7480
|
}
|
|
7481
|
+
if (resourceType === "AWS::Logs::LogGroup") {
|
|
7482
|
+
const derivedRetention = logsDeliveryDerivedRetention(declared["LogGroupClass"]);
|
|
7483
|
+
if (derivedRetention !== void 0) knownDef = {
|
|
7484
|
+
...knownDef,
|
|
7485
|
+
RetentionInDays: derivedRetention
|
|
7486
|
+
};
|
|
7487
|
+
}
|
|
7421
7488
|
if (resourceType === "AWS::ApiGateway::RestApi") {
|
|
7422
7489
|
const types = declared["EndpointConfiguration"]?.["Types"];
|
|
7423
7490
|
if (Array.isArray(types) && types.includes("PRIVATE")) {
|
|
@@ -8398,7 +8465,9 @@ function classifyResource(resource, liveRaw, schema, opts = {}) {
|
|
|
8398
8465
|
const pid = resource.physicalId;
|
|
8399
8466
|
const unresolvedSibling = IAM_PRINCIPAL_POLICY_TYPES.has(resourceType) && resource.siblingPolicyNames === "unresolved";
|
|
8400
8467
|
const bands = opts.scalableTargetBands?.[resource.logicalId];
|
|
8401
|
-
|
|
8468
|
+
const folded = bands ? applyAutoscalerBandFold(findings, bands) : findings;
|
|
8469
|
+
const bgAllowed = resourceType === "AWS::ElasticLoadBalancingV2::ListenerRule" ? opts.ecsBgGovernedListenerRules?.[resource.logicalId] ?? (pid !== void 0 ? opts.ecsBgGovernedListenerRules?.[pid] : void 0) : void 0;
|
|
8470
|
+
return (bgAllowed ? applyEcsBlueGreenListenerRuleFold(folded, bgAllowed, liveRaw) : folded).map((f) => ({
|
|
8402
8471
|
...f,
|
|
8403
8472
|
...pid !== void 0 && { physicalId: pid },
|
|
8404
8473
|
...cp !== void 0 && { constructPath: cp },
|
|
@@ -9144,6 +9213,11 @@ async function enumerateSnsTopicChildren(ctx) {
|
|
|
9144
9213
|
for (const r of desired.resources) if (r.resourceType === "AWS::SNS::Subscription" && parentRefMatches(r.declared.TopicArn, topicArn) && r.physicalId) declaredSubscriptionArns.push(r.physicalId);
|
|
9145
9214
|
let hasDeclaredPolicy = false;
|
|
9146
9215
|
for (const r of desired.resources) {
|
|
9216
|
+
if (r.resourceType === "AWS::SNS::TopicInlinePolicy") {
|
|
9217
|
+
const t = r.declared.TopicArn;
|
|
9218
|
+
if (t === topicArn || t !== void 0 && hasUnresolved(t)) hasDeclaredPolicy = true;
|
|
9219
|
+
continue;
|
|
9220
|
+
}
|
|
9147
9221
|
if (r.resourceType !== "AWS::SNS::TopicPolicy") continue;
|
|
9148
9222
|
const topics = r.declared.Topics;
|
|
9149
9223
|
if (Array.isArray(topics)) {
|
|
@@ -9575,6 +9649,11 @@ async function enumerateSqsQueueChildren(ctx) {
|
|
|
9575
9649
|
if (!queueUrl) return [];
|
|
9576
9650
|
let hasDeclaredPolicy = false;
|
|
9577
9651
|
for (const r of desired.resources) {
|
|
9652
|
+
if (r.resourceType === "AWS::SQS::QueueInlinePolicy") {
|
|
9653
|
+
const q = r.declared.Queue;
|
|
9654
|
+
if (q === queueUrl || q !== void 0 && hasUnresolved(q)) hasDeclaredPolicy = true;
|
|
9655
|
+
continue;
|
|
9656
|
+
}
|
|
9578
9657
|
if (r.resourceType !== "AWS::SQS::QueuePolicy") continue;
|
|
9579
9658
|
const queues = r.declared.Queues;
|
|
9580
9659
|
if (Array.isArray(queues)) {
|
|
@@ -10253,6 +10332,16 @@ async function pageSubscriptionFilters(client, logGroupName) {
|
|
|
10253
10332
|
} while (next);
|
|
10254
10333
|
return out;
|
|
10255
10334
|
}
|
|
10335
|
+
async function tolerateNonStandardLogClass(call) {
|
|
10336
|
+
try {
|
|
10337
|
+
return await call();
|
|
10338
|
+
} catch (e) {
|
|
10339
|
+
const err = e;
|
|
10340
|
+
const msg = typeof err.message === "string" ? err.message : "";
|
|
10341
|
+
if (err.name === "ValidationException" && msg.includes("Standard log class")) return [];
|
|
10342
|
+
throw e;
|
|
10343
|
+
}
|
|
10344
|
+
}
|
|
10256
10345
|
async function enumerateLogGroupChildren(ctx) {
|
|
10257
10346
|
const { parent, desired, region } = ctx;
|
|
10258
10347
|
const logGroupName = parent.physicalId;
|
|
@@ -10273,8 +10362,8 @@ async function enumerateLogGroupChildren(ctx) {
|
|
|
10273
10362
|
region,
|
|
10274
10363
|
...READ_RETRY
|
|
10275
10364
|
});
|
|
10276
|
-
const liveFilters = (await pageMetricFilters(client, logGroupName)).filter((f) => typeof f.filterName === "string").map((f) => ({ name: f.filterName }));
|
|
10277
|
-
const liveSubs = (await pageSubscriptionFilters(client, logGroupName)).filter((f) => typeof f.filterName === "string").map((f) => ({ name: f.filterName }));
|
|
10365
|
+
const liveFilters = (await tolerateNonStandardLogClass(() => pageMetricFilters(client, logGroupName))).filter((f) => typeof f.filterName === "string").map((f) => ({ name: f.filterName }));
|
|
10366
|
+
const liveSubs = (await tolerateNonStandardLogClass(() => pageSubscriptionFilters(client, logGroupName))).filter((f) => typeof f.filterName === "string").map((f) => ({ name: f.filterName }));
|
|
10278
10367
|
return [...diffLogGroupChildren({
|
|
10279
10368
|
logGroupName,
|
|
10280
10369
|
declaredFilterNames,
|
|
@@ -10481,7 +10570,7 @@ function diffVpcCidrBlockChildren(input) {
|
|
|
10481
10570
|
return added;
|
|
10482
10571
|
}
|
|
10483
10572
|
function isAwsManagedSecurityGroup(tags) {
|
|
10484
|
-
return (tags ?? []).some((t) => typeof t.Key === "string" && (t.Key.startsWith("aws:") || t.Key.startsWith("kubernetes.io/cluster/")));
|
|
10573
|
+
return (tags ?? []).some((t) => typeof t.Key === "string" && (t.Key.startsWith("aws:") || t.Key.startsWith("kubernetes.io/cluster/") || t.Key === "aws.cloudfront.vpcorigin"));
|
|
10485
10574
|
}
|
|
10486
10575
|
function diffVpcSecurityGroupChildren(input) {
|
|
10487
10576
|
const declared = new Set(input.declaredSecurityGroupIds);
|
|
@@ -15693,7 +15782,12 @@ function buildSiblingTargetGroupRegistrars(desired) {
|
|
|
15693
15782
|
if (r.resourceType === ECS_SERVICE_TYPE) {
|
|
15694
15783
|
const lbs = d.LoadBalancers;
|
|
15695
15784
|
if (Array.isArray(lbs)) {
|
|
15696
|
-
for (const lb of lbs) if (lb && typeof lb === "object")
|
|
15785
|
+
for (const lb of lbs) if (lb && typeof lb === "object") {
|
|
15786
|
+
const lbo = lb;
|
|
15787
|
+
markTg(lbo.TargetGroupArn);
|
|
15788
|
+
const adv = lbo.AdvancedConfiguration;
|
|
15789
|
+
if (adv && typeof adv === "object") markTg(adv.AlternateTargetGroupArn);
|
|
15790
|
+
}
|
|
15697
15791
|
}
|
|
15698
15792
|
} else if (r.resourceType === AUTO_SCALING_GROUP_TYPE) {
|
|
15699
15793
|
const arns = d.TargetGroupARNs;
|
|
@@ -15705,6 +15799,62 @@ function buildSiblingTargetGroupRegistrars(desired) {
|
|
|
15705
15799
|
}
|
|
15706
15800
|
return registered;
|
|
15707
15801
|
}
|
|
15802
|
+
function buildEcsBgGovernedListenerRules(desired) {
|
|
15803
|
+
const LISTENER_RULE_TYPE = "AWS::ElasticLoadBalancingV2::ListenerRule";
|
|
15804
|
+
const ruleIdsByLogicalId = /* @__PURE__ */ new Map();
|
|
15805
|
+
const ruleLogicalIdByPhysicalId = /* @__PURE__ */ new Map();
|
|
15806
|
+
const tgIdsByLogicalId = /* @__PURE__ */ new Map();
|
|
15807
|
+
for (const r of desired.resources) if (r.resourceType === LISTENER_RULE_TYPE) {
|
|
15808
|
+
ruleIdsByLogicalId.set(r.logicalId, [r.logicalId, ...r.physicalId ? [r.physicalId] : []]);
|
|
15809
|
+
if (r.physicalId) ruleLogicalIdByPhysicalId.set(r.physicalId, r.logicalId);
|
|
15810
|
+
} else if (r.resourceType === TARGET_GROUP_TYPE) tgIdsByLogicalId.set(r.logicalId, [r.logicalId, ...r.physicalId ? [r.physicalId] : []]);
|
|
15811
|
+
const refLogicalId = (ref) => {
|
|
15812
|
+
if (ref && typeof ref === "object") {
|
|
15813
|
+
if ("Ref" in ref && typeof ref.Ref === "string") return ref.Ref;
|
|
15814
|
+
if ("Fn::GetAtt" in ref) {
|
|
15815
|
+
const g = ref["Fn::GetAtt"];
|
|
15816
|
+
if (Array.isArray(g) && typeof g[0] === "string") return g[0];
|
|
15817
|
+
}
|
|
15818
|
+
}
|
|
15819
|
+
};
|
|
15820
|
+
const out = {};
|
|
15821
|
+
for (const r of desired.resources) {
|
|
15822
|
+
if (r.resourceType !== ECS_SERVICE_TYPE) continue;
|
|
15823
|
+
const decl = r.declared;
|
|
15824
|
+
if (!decl || typeof decl !== "object") continue;
|
|
15825
|
+
const lbs = decl.LoadBalancers;
|
|
15826
|
+
if (!Array.isArray(lbs)) continue;
|
|
15827
|
+
for (const lb of lbs) {
|
|
15828
|
+
if (!lb || typeof lb !== "object") continue;
|
|
15829
|
+
const lbo = lb;
|
|
15830
|
+
const adv = lbo.AdvancedConfiguration;
|
|
15831
|
+
if (!adv || typeof adv !== "object") continue;
|
|
15832
|
+
const advo = adv;
|
|
15833
|
+
const allowed = [];
|
|
15834
|
+
for (const tgRef of [lbo.TargetGroupArn, advo.AlternateTargetGroupArn]) {
|
|
15835
|
+
const lg = refLogicalId(tgRef);
|
|
15836
|
+
if (lg !== void 0) {
|
|
15837
|
+
const ids = tgIdsByLogicalId.get(lg);
|
|
15838
|
+
if (ids) allowed.push(...ids);
|
|
15839
|
+
} else if (typeof tgRef === "string" && tgRef) allowed.push(tgRef);
|
|
15840
|
+
}
|
|
15841
|
+
if (allowed.length === 0) continue;
|
|
15842
|
+
for (const key of ["ProductionListenerRule", "TestListenerRule"]) {
|
|
15843
|
+
const ruleRef = advo[key];
|
|
15844
|
+
let ruleIds;
|
|
15845
|
+
const lg = refLogicalId(ruleRef);
|
|
15846
|
+
if (lg !== void 0) ruleIds = ruleIdsByLogicalId.get(lg);
|
|
15847
|
+
else if (typeof ruleRef === "string" && ruleRef) {
|
|
15848
|
+
const rl = ruleLogicalIdByPhysicalId.get(ruleRef);
|
|
15849
|
+
ruleIds = rl !== void 0 ? ruleIdsByLogicalId.get(rl) : [ruleRef];
|
|
15850
|
+
}
|
|
15851
|
+
if (!ruleIds) continue;
|
|
15852
|
+
for (const id of ruleIds) out[id] = [...new Set([...out[id] ?? [], ...allowed])];
|
|
15853
|
+
}
|
|
15854
|
+
}
|
|
15855
|
+
}
|
|
15856
|
+
return out;
|
|
15857
|
+
}
|
|
15708
15858
|
function buildClusterEchoModels(desired) {
|
|
15709
15859
|
const parentTypes = new Set(Object.values(CLUSTER_ECHO_CHILD).map((s) => s.parentType));
|
|
15710
15860
|
const clusterByPhys = {};
|
|
@@ -16046,6 +16196,7 @@ async function gatherFindings(stackName, region, templateOverride, recoveryTempl
|
|
|
16046
16196
|
bucketNotificationConfigs: buildBucketNotificationConfigs(desired),
|
|
16047
16197
|
clusterEchoModel: buildClusterEchoModels(desired),
|
|
16048
16198
|
scalableTargetBands: buildScalableTargetBands(desired),
|
|
16199
|
+
ecsBgGovernedListenerRules: buildEcsBgGovernedListenerRules(desired),
|
|
16049
16200
|
siblingClientVpnEndpointVpcs: buildClientVpnEndpointSiblingVpcs(desired),
|
|
16050
16201
|
siblingCloudFrontCdPolicyIds: buildCloudFrontStagingDistCdPolicyIds(desired, liveModelMap(reads)),
|
|
16051
16202
|
siblingRdsSourceModels: buildRdsReplicaSourceModels(desired, liveModelMap(reads)),
|
|
@@ -16125,6 +16276,7 @@ async function regatherTouched(gathered, touched, region) {
|
|
|
16125
16276
|
bucketNotificationConfigs: buildBucketNotificationConfigs(desired),
|
|
16126
16277
|
clusterEchoModel: buildClusterEchoModels(desired),
|
|
16127
16278
|
scalableTargetBands: buildScalableTargetBands(desired),
|
|
16279
|
+
ecsBgGovernedListenerRules: buildEcsBgGovernedListenerRules(desired),
|
|
16128
16280
|
siblingClientVpnEndpointVpcs: buildClientVpnEndpointSiblingVpcs(desired),
|
|
16129
16281
|
siblingCloudFrontCdPolicyIds: buildCloudFrontStagingDistCdPolicyIds(desired, new Map([...gathered.liveByLogical, ...liveModelMap(reads)])),
|
|
16130
16282
|
siblingRdsSourceModels: buildRdsReplicaSourceModels(desired, new Map([...gathered.liveByLogical, ...liveModelMap(reads)])),
|
|
@@ -20127,13 +20279,25 @@ const deleteKmsGrant = async (ctx) => {
|
|
|
20127
20279
|
GrantId: ctx.physicalId
|
|
20128
20280
|
}));
|
|
20129
20281
|
};
|
|
20282
|
+
const deleteGlueTable = async (ctx) => {
|
|
20283
|
+
const sep = ctx.physicalId.indexOf("|");
|
|
20284
|
+
if (sep <= 0) throw new Error(`cannot split the Glue table identifier '${ctx.physicalId}' into DatabaseName|TableName`);
|
|
20285
|
+
await new GlueClient({
|
|
20286
|
+
region: ctx.region,
|
|
20287
|
+
...CLIENT_TIMEOUTS
|
|
20288
|
+
}).send(new DeleteTableCommand({
|
|
20289
|
+
DatabaseName: ctx.physicalId.slice(0, sep),
|
|
20290
|
+
Name: ctx.physicalId.slice(sep + 1)
|
|
20291
|
+
}));
|
|
20292
|
+
};
|
|
20130
20293
|
const SDK_DELETERS = {
|
|
20131
20294
|
"AWS::AppSync::ApiKey": deleteAppSyncApiKey,
|
|
20132
20295
|
"AWS::Route53::RecordSet": deleteRoute53RecordSet,
|
|
20133
20296
|
"AWS::SQS::QueuePolicy": deleteSqsQueuePolicy,
|
|
20134
20297
|
"AWS::SecretsManager::ResourcePolicy": deleteSecretsManagerResourcePolicy,
|
|
20135
20298
|
"AWS::SNS::TopicPolicy": deleteSnsTopicPolicy,
|
|
20136
|
-
"AWS::KMS::Grant": deleteKmsGrant
|
|
20299
|
+
"AWS::KMS::Grant": deleteKmsGrant,
|
|
20300
|
+
"AWS::Glue::Table": deleteGlueTable
|
|
20137
20301
|
};
|
|
20138
20302
|
|
|
20139
20303
|
//#endregion
|
|
@@ -20153,6 +20317,7 @@ const CC_REVERTABLE_DESPITE_READ_OVERRIDE = new Set([
|
|
|
20153
20317
|
const REVERT_SET_DEFAULT_PATHS = new Set([
|
|
20154
20318
|
"AWS::EC2::CapacityReservation\0InstanceMatchCriteria",
|
|
20155
20319
|
"AWS::EC2::CapacityReservation\0EndDateType",
|
|
20320
|
+
"AWS::CodeDeploy::DeploymentGroup\0DeploymentConfigName",
|
|
20156
20321
|
"AWS::DLM::LifecyclePolicy\0RetainInterval",
|
|
20157
20322
|
"AWS::DLM::LifecyclePolicy\0CreateInterval",
|
|
20158
20323
|
"AWS::IAM::Role\0MaxSessionDuration",
|
|
@@ -20428,6 +20593,15 @@ function buildRevertPlan(findings, baseline, opts = {}) {
|
|
|
20428
20593
|
});
|
|
20429
20594
|
continue;
|
|
20430
20595
|
}
|
|
20596
|
+
if (f.ecsBlueGreenGoverned) {
|
|
20597
|
+
notRevertable.push({
|
|
20598
|
+
displayId,
|
|
20599
|
+
resourceType: f.resourceType,
|
|
20600
|
+
path: f.path,
|
|
20601
|
+
reason: "managed by an ECS blue/green deployment — revert would fight the deployment controller; update the service's AdvancedConfiguration, or record/ignore to accept"
|
|
20602
|
+
});
|
|
20603
|
+
continue;
|
|
20604
|
+
}
|
|
20431
20605
|
if (f.tier === "deleted") {
|
|
20432
20606
|
notRevertable.push({
|
|
20433
20607
|
displayId,
|
|
@@ -20704,6 +20878,7 @@ function derivedRevertDefaultFor(resourceType, path, declared) {
|
|
|
20704
20878
|
if (path === "HealthCheckPort") return elbTargetGroupDerivedHealthCheckPort(declared["Protocol"]);
|
|
20705
20879
|
}
|
|
20706
20880
|
if (resourceType === "AWS::RDS::DBInstance" && path === "BackupRetentionPeriod") return rdsReplicaDerivedBackupRetention(declared["SourceDBInstanceIdentifier"]);
|
|
20881
|
+
if (resourceType === "AWS::Logs::LogGroup" && path === "RetentionInDays") return logsDeliveryDerivedRetention(declared["LogGroupClass"]);
|
|
20707
20882
|
}
|
|
20708
20883
|
const REVERT_COMPANION_REMOVES = {
|
|
20709
20884
|
"AWS::ElasticLoadBalancingV2::TargetGroup\0HealthCheckProtocol": (value) => value === "TCP" ? ["Matcher", "HealthCheckPath"] : [],
|