cdk-real-drift 0.12.5 → 0.12.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +69 -1
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1643,6 +1643,7 @@ function buildCorpusCase(resource, liveRaw, schema, opts, findings) {
|
|
|
1643
1643
|
const sgSibling = resource.resourceType === "AWS::EC2::SecurityGroup" && resource.physicalId ? opts.siblingSgRules?.[resource.physicalId] : void 0;
|
|
1644
1644
|
const bucketNotif = resource.physicalId && opts.bucketNotificationManaged?.has(resource.physicalId) ? [resource.physicalId] : void 0;
|
|
1645
1645
|
const eipSiblingId = resource.physicalId && opts.siblingEipAssociations?.has(resource.physicalId) ? resource.physicalId : opts.siblingEipAssociations?.has(resource.logicalId) ? resource.logicalId : void 0;
|
|
1646
|
+
const tgRegistrarId = resource.physicalId && opts.siblingTargetGroupRegistrars?.has(resource.physicalId) ? resource.physicalId : opts.siblingTargetGroupRegistrars?.has(resource.logicalId) ? resource.logicalId : void 0;
|
|
1646
1647
|
const echoModel = resource.physicalId && opts.clusterEchoModel?.[resource.physicalId] ? opts.clusterEchoModel[resource.physicalId] : void 0;
|
|
1647
1648
|
const rdsOptCatalog = resource.physicalId && opts.rdsOptionSettingDefaults?.[resource.physicalId] ? opts.rdsOptionSettingDefaults[resource.physicalId] : void 0;
|
|
1648
1649
|
const listenerArn = resource.resourceType === "AWS::GlobalAccelerator::EndpointGroup" ? resource.declared?.ListenerArn : void 0;
|
|
@@ -1679,6 +1680,7 @@ function buildCorpusCase(resource, liveRaw, schema, opts, findings) {
|
|
|
1679
1680
|
...sgSibling && resource.physicalId ? { siblingSgRules: { [resource.physicalId]: sgSibling } } : {},
|
|
1680
1681
|
...bucketNotif ? { bucketNotificationManaged: bucketNotif } : {},
|
|
1681
1682
|
...eipSiblingId ? { siblingEipAssociations: [eipSiblingId] } : {},
|
|
1683
|
+
...tgRegistrarId ? { siblingTargetGroupRegistrars: [tgRegistrarId] } : {},
|
|
1682
1684
|
...echoModel && resource.physicalId ? { clusterEchoModel: { [resource.physicalId]: echoModel } } : {},
|
|
1683
1685
|
...rdsOptCatalog && resource.physicalId ? { rdsOptionSettingDefaults: { [resource.physicalId]: rdsOptCatalog } } : {},
|
|
1684
1686
|
...gaListenerPort ? { siblingListenerPorts: gaListenerPort } : {}
|
|
@@ -2884,7 +2886,6 @@ const GENERATED_TOPLEVEL_PATHS = {
|
|
|
2884
2886
|
"AWS::EC2::SecurityGroupIngress": new Set(["SourceSecurityGroupOwnerId", "GroupName"]),
|
|
2885
2887
|
"AWS::ECS::Service": new Set(["Role"]),
|
|
2886
2888
|
"AWS::SecretsManager::Secret": new Set(["Name"]),
|
|
2887
|
-
"AWS::ElasticLoadBalancingV2::TargetGroup": new Set(["Targets"]),
|
|
2888
2889
|
"AWS::ApplicationAutoScaling::ScalingPolicy": new Set([
|
|
2889
2890
|
"ResourceId",
|
|
2890
2891
|
"ServiceNamespace",
|
|
@@ -6518,6 +6519,16 @@ function classifyResource(resource, liveRaw, schema, opts = {}) {
|
|
|
6518
6519
|
});
|
|
6519
6520
|
continue;
|
|
6520
6521
|
}
|
|
6522
|
+
if (resourceType === "AWS::ElasticLoadBalancingV2::TargetGroup" && k === "Targets" && (physicalId !== void 0 && opts.siblingTargetGroupRegistrars?.has(physicalId) || opts.siblingTargetGroupRegistrars?.has(logicalId))) {
|
|
6523
|
+
findings.push({
|
|
6524
|
+
tier: "generated",
|
|
6525
|
+
logicalId,
|
|
6526
|
+
resourceType,
|
|
6527
|
+
path: k,
|
|
6528
|
+
actual: v
|
|
6529
|
+
});
|
|
6530
|
+
continue;
|
|
6531
|
+
}
|
|
6521
6532
|
if (isAllAwsTags(v)) continue;
|
|
6522
6533
|
if (physicalId !== void 0 && v === physicalId) continue;
|
|
6523
6534
|
const offStateIsMeaningful = k in knownDef && !matchesKnownDefault(v, knownDef[k]) && (MEANINGFUL_WHEN_OFF[resourceType]?.[k]?.({
|
|
@@ -11378,6 +11389,61 @@ function buildSiblingEipAssociations(desired) {
|
|
|
11378
11389
|
}
|
|
11379
11390
|
return associated;
|
|
11380
11391
|
}
|
|
11392
|
+
const ECS_SERVICE_TYPE = "AWS::ECS::Service";
|
|
11393
|
+
const AUTO_SCALING_GROUP_TYPE = "AWS::AutoScaling::AutoScalingGroup";
|
|
11394
|
+
const TARGET_GROUP_TYPE = "AWS::ElasticLoadBalancingV2::TargetGroup";
|
|
11395
|
+
function buildSiblingTargetGroupRegistrars(desired) {
|
|
11396
|
+
const tgIdentitiesByLogicalId = /* @__PURE__ */ new Map();
|
|
11397
|
+
const tgLogicalIdByPhysicalId = /* @__PURE__ */ new Map();
|
|
11398
|
+
for (const r of desired.resources) {
|
|
11399
|
+
if (r.resourceType !== TARGET_GROUP_TYPE) continue;
|
|
11400
|
+
const ids = [r.logicalId];
|
|
11401
|
+
if (r.physicalId) {
|
|
11402
|
+
ids.push(r.physicalId);
|
|
11403
|
+
tgLogicalIdByPhysicalId.set(r.physicalId, r.logicalId);
|
|
11404
|
+
}
|
|
11405
|
+
tgIdentitiesByLogicalId.set(r.logicalId, ids);
|
|
11406
|
+
}
|
|
11407
|
+
const registered = /* @__PURE__ */ new Set();
|
|
11408
|
+
const markTg = (ref) => {
|
|
11409
|
+
let tgLogicalId;
|
|
11410
|
+
if (ref && typeof ref === "object") {
|
|
11411
|
+
if ("Ref" in ref && typeof ref.Ref === "string") tgLogicalId = ref.Ref;
|
|
11412
|
+
else if ("Fn::GetAtt" in ref) {
|
|
11413
|
+
const g = ref["Fn::GetAtt"];
|
|
11414
|
+
if (Array.isArray(g) && typeof g[0] === "string") tgLogicalId = g[0];
|
|
11415
|
+
}
|
|
11416
|
+
}
|
|
11417
|
+
if (tgLogicalId !== void 0) {
|
|
11418
|
+
const ids = tgIdentitiesByLogicalId.get(tgLogicalId);
|
|
11419
|
+
if (ids) for (const id of ids) registered.add(id);
|
|
11420
|
+
return;
|
|
11421
|
+
}
|
|
11422
|
+
if (typeof ref === "string" && ref) {
|
|
11423
|
+
registered.add(ref);
|
|
11424
|
+
const logicalId = tgLogicalIdByPhysicalId.get(ref);
|
|
11425
|
+
if (logicalId) registered.add(logicalId);
|
|
11426
|
+
}
|
|
11427
|
+
};
|
|
11428
|
+
for (const r of desired.resources) {
|
|
11429
|
+
const decl = r.declared;
|
|
11430
|
+
if (!decl || typeof decl !== "object") continue;
|
|
11431
|
+
const d = decl;
|
|
11432
|
+
if (r.resourceType === ECS_SERVICE_TYPE) {
|
|
11433
|
+
const lbs = d.LoadBalancers;
|
|
11434
|
+
if (Array.isArray(lbs)) {
|
|
11435
|
+
for (const lb of lbs) if (lb && typeof lb === "object") markTg(lb.TargetGroupArn);
|
|
11436
|
+
}
|
|
11437
|
+
} else if (r.resourceType === AUTO_SCALING_GROUP_TYPE) {
|
|
11438
|
+
const arns = d.TargetGroupARNs;
|
|
11439
|
+
if (Array.isArray(arns)) for (const arn of arns) markTg(arn);
|
|
11440
|
+
} else if (r.resourceType === TARGET_GROUP_TYPE && d.TargetType === "lambda") {
|
|
11441
|
+
const ids = tgIdentitiesByLogicalId.get(r.logicalId);
|
|
11442
|
+
if (ids) for (const id of ids) registered.add(id);
|
|
11443
|
+
}
|
|
11444
|
+
}
|
|
11445
|
+
return registered;
|
|
11446
|
+
}
|
|
11381
11447
|
function buildClusterEchoModels(desired) {
|
|
11382
11448
|
const parentTypes = new Set(Object.values(CLUSTER_ECHO_CHILD).map((s) => s.parentType));
|
|
11383
11449
|
const clusterByPhys = {};
|
|
@@ -11589,6 +11655,7 @@ async function gatherFindings(stackName, region, templateOverride, recoveryTempl
|
|
|
11589
11655
|
siblingLifecycleHooks: buildSiblingLifecycleHooks(desired),
|
|
11590
11656
|
siblingListenerPorts: buildSiblingListenerPorts(desired),
|
|
11591
11657
|
siblingEipAssociations: buildSiblingEipAssociations(desired),
|
|
11658
|
+
siblingTargetGroupRegistrars: buildSiblingTargetGroupRegistrars(desired),
|
|
11592
11659
|
bucketNotificationManaged: buildBucketNotificationManaged(desired),
|
|
11593
11660
|
clusterEchoModel: buildClusterEchoModels(desired),
|
|
11594
11661
|
rdsOptionSettingDefaults: await buildRdsOptionSettingDefaults(desired, region)
|
|
@@ -11657,6 +11724,7 @@ async function regatherTouched(gathered, touched, region) {
|
|
|
11657
11724
|
siblingLifecycleHooks: buildSiblingLifecycleHooks(desired),
|
|
11658
11725
|
siblingListenerPorts: buildSiblingListenerPorts(desired),
|
|
11659
11726
|
siblingEipAssociations: buildSiblingEipAssociations(desired),
|
|
11727
|
+
siblingTargetGroupRegistrars: buildSiblingTargetGroupRegistrars(desired),
|
|
11660
11728
|
bucketNotificationManaged: buildBucketNotificationManaged(desired),
|
|
11661
11729
|
clusterEchoModel: buildClusterEchoModels(desired),
|
|
11662
11730
|
rdsOptionSettingDefaults: await buildRdsOptionSettingDefaults(desired, region)
|