cdk-real-drift 0.12.5 → 0.12.7

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 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 } : {}
@@ -2835,6 +2837,7 @@ const CONTEXT_ARN_DEFAULTS = {
2835
2837
  "AWS::CodeBuild::Project": { EncryptionKey: "arn:{partition}:kms:{region}:{accountId}:alias/aws/s3" },
2836
2838
  "AWS::SSM::MaintenanceWindowTask": { ServiceRoleArn: "arn:{partition}:iam::{accountId}:role/aws-service-role/ssm.amazonaws.com/AWSServiceRoleForAmazonSSM" },
2837
2839
  "AWS::LakeFormation::Tag": { CatalogId: "{accountId}" },
2840
+ "AWS::LakeFormation::PrincipalPermissions": { Catalog: "{accountId}" },
2838
2841
  "AWS::S3::AccessPoint": { BucketAccountId: "{accountId}" },
2839
2842
  "AWS::EC2::VPCPeeringConnection": { PeerOwnerId: "{accountId}" },
2840
2843
  "AWS::Chatbot::SlackChannelConfiguration": { GuardrailPolicies: ["arn:{partition}:iam::aws:policy/AdministratorAccess"] }
@@ -2884,7 +2887,6 @@ const GENERATED_TOPLEVEL_PATHS = {
2884
2887
  "AWS::EC2::SecurityGroupIngress": new Set(["SourceSecurityGroupOwnerId", "GroupName"]),
2885
2888
  "AWS::ECS::Service": new Set(["Role"]),
2886
2889
  "AWS::SecretsManager::Secret": new Set(["Name"]),
2887
- "AWS::ElasticLoadBalancingV2::TargetGroup": new Set(["Targets"]),
2888
2890
  "AWS::ApplicationAutoScaling::ScalingPolicy": new Set([
2889
2891
  "ResourceId",
2890
2892
  "ServiceNamespace",
@@ -6518,6 +6520,16 @@ function classifyResource(resource, liveRaw, schema, opts = {}) {
6518
6520
  });
6519
6521
  continue;
6520
6522
  }
6523
+ if (resourceType === "AWS::ElasticLoadBalancingV2::TargetGroup" && k === "Targets" && (physicalId !== void 0 && opts.siblingTargetGroupRegistrars?.has(physicalId) || opts.siblingTargetGroupRegistrars?.has(logicalId))) {
6524
+ findings.push({
6525
+ tier: "generated",
6526
+ logicalId,
6527
+ resourceType,
6528
+ path: k,
6529
+ actual: v
6530
+ });
6531
+ continue;
6532
+ }
6521
6533
  if (isAllAwsTags(v)) continue;
6522
6534
  if (physicalId !== void 0 && v === physicalId) continue;
6523
6535
  const offStateIsMeaningful = k in knownDef && !matchesKnownDefault(v, knownDef[k]) && (MEANINGFUL_WHEN_OFF[resourceType]?.[k]?.({
@@ -11378,6 +11390,61 @@ function buildSiblingEipAssociations(desired) {
11378
11390
  }
11379
11391
  return associated;
11380
11392
  }
11393
+ const ECS_SERVICE_TYPE = "AWS::ECS::Service";
11394
+ const AUTO_SCALING_GROUP_TYPE = "AWS::AutoScaling::AutoScalingGroup";
11395
+ const TARGET_GROUP_TYPE = "AWS::ElasticLoadBalancingV2::TargetGroup";
11396
+ function buildSiblingTargetGroupRegistrars(desired) {
11397
+ const tgIdentitiesByLogicalId = /* @__PURE__ */ new Map();
11398
+ const tgLogicalIdByPhysicalId = /* @__PURE__ */ new Map();
11399
+ for (const r of desired.resources) {
11400
+ if (r.resourceType !== TARGET_GROUP_TYPE) continue;
11401
+ const ids = [r.logicalId];
11402
+ if (r.physicalId) {
11403
+ ids.push(r.physicalId);
11404
+ tgLogicalIdByPhysicalId.set(r.physicalId, r.logicalId);
11405
+ }
11406
+ tgIdentitiesByLogicalId.set(r.logicalId, ids);
11407
+ }
11408
+ const registered = /* @__PURE__ */ new Set();
11409
+ const markTg = (ref) => {
11410
+ let tgLogicalId;
11411
+ if (ref && typeof ref === "object") {
11412
+ if ("Ref" in ref && typeof ref.Ref === "string") tgLogicalId = ref.Ref;
11413
+ else if ("Fn::GetAtt" in ref) {
11414
+ const g = ref["Fn::GetAtt"];
11415
+ if (Array.isArray(g) && typeof g[0] === "string") tgLogicalId = g[0];
11416
+ }
11417
+ }
11418
+ if (tgLogicalId !== void 0) {
11419
+ const ids = tgIdentitiesByLogicalId.get(tgLogicalId);
11420
+ if (ids) for (const id of ids) registered.add(id);
11421
+ return;
11422
+ }
11423
+ if (typeof ref === "string" && ref) {
11424
+ registered.add(ref);
11425
+ const logicalId = tgLogicalIdByPhysicalId.get(ref);
11426
+ if (logicalId) registered.add(logicalId);
11427
+ }
11428
+ };
11429
+ for (const r of desired.resources) {
11430
+ const decl = r.declared;
11431
+ if (!decl || typeof decl !== "object") continue;
11432
+ const d = decl;
11433
+ if (r.resourceType === ECS_SERVICE_TYPE) {
11434
+ const lbs = d.LoadBalancers;
11435
+ if (Array.isArray(lbs)) {
11436
+ for (const lb of lbs) if (lb && typeof lb === "object") markTg(lb.TargetGroupArn);
11437
+ }
11438
+ } else if (r.resourceType === AUTO_SCALING_GROUP_TYPE) {
11439
+ const arns = d.TargetGroupARNs;
11440
+ if (Array.isArray(arns)) for (const arn of arns) markTg(arn);
11441
+ } else if (r.resourceType === TARGET_GROUP_TYPE && d.TargetType === "lambda") {
11442
+ const ids = tgIdentitiesByLogicalId.get(r.logicalId);
11443
+ if (ids) for (const id of ids) registered.add(id);
11444
+ }
11445
+ }
11446
+ return registered;
11447
+ }
11381
11448
  function buildClusterEchoModels(desired) {
11382
11449
  const parentTypes = new Set(Object.values(CLUSTER_ECHO_CHILD).map((s) => s.parentType));
11383
11450
  const clusterByPhys = {};
@@ -11589,6 +11656,7 @@ async function gatherFindings(stackName, region, templateOverride, recoveryTempl
11589
11656
  siblingLifecycleHooks: buildSiblingLifecycleHooks(desired),
11590
11657
  siblingListenerPorts: buildSiblingListenerPorts(desired),
11591
11658
  siblingEipAssociations: buildSiblingEipAssociations(desired),
11659
+ siblingTargetGroupRegistrars: buildSiblingTargetGroupRegistrars(desired),
11592
11660
  bucketNotificationManaged: buildBucketNotificationManaged(desired),
11593
11661
  clusterEchoModel: buildClusterEchoModels(desired),
11594
11662
  rdsOptionSettingDefaults: await buildRdsOptionSettingDefaults(desired, region)
@@ -11657,6 +11725,7 @@ async function regatherTouched(gathered, touched, region) {
11657
11725
  siblingLifecycleHooks: buildSiblingLifecycleHooks(desired),
11658
11726
  siblingListenerPorts: buildSiblingListenerPorts(desired),
11659
11727
  siblingEipAssociations: buildSiblingEipAssociations(desired),
11728
+ siblingTargetGroupRegistrars: buildSiblingTargetGroupRegistrars(desired),
11660
11729
  bucketNotificationManaged: buildBucketNotificationManaged(desired),
11661
11730
  clusterEchoModel: buildClusterEchoModels(desired),
11662
11731
  rdsOptionSettingDefaults: await buildRdsOptionSettingDefaults(desired, region)