cdk-real-drift 0.11.0 → 0.11.2

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,8 @@ function buildCorpusCase(resource, liveRaw, schema, opts, findings) {
1643
1643
  const bucketNotif = resource.physicalId && opts.bucketNotificationManaged?.has(resource.physicalId) ? [resource.physicalId] : void 0;
1644
1644
  const echoModel = resource.physicalId && opts.clusterEchoModel?.[resource.physicalId] ? opts.clusterEchoModel[resource.physicalId] : void 0;
1645
1645
  const rdsOptCatalog = resource.physicalId && opts.rdsOptionSettingDefaults?.[resource.physicalId] ? opts.rdsOptionSettingDefaults[resource.physicalId] : void 0;
1646
+ const listenerArn = resource.resourceType === "AWS::GlobalAccelerator::EndpointGroup" ? resource.declared?.ListenerArn : void 0;
1647
+ const gaListenerPort = typeof listenerArn === "string" && opts.siblingListenerPorts?.[listenerArn] !== void 0 ? { [listenerArn]: opts.siblingListenerPorts[listenerArn] } : void 0;
1646
1648
  return sanitizeAccountId({
1647
1649
  corpusVersion: 1,
1648
1650
  resource: {
@@ -1675,7 +1677,8 @@ function buildCorpusCase(resource, liveRaw, schema, opts, findings) {
1675
1677
  ...sgSibling && resource.physicalId ? { siblingSgRules: { [resource.physicalId]: sgSibling } } : {},
1676
1678
  ...bucketNotif ? { bucketNotificationManaged: bucketNotif } : {},
1677
1679
  ...echoModel && resource.physicalId ? { clusterEchoModel: { [resource.physicalId]: echoModel } } : {},
1678
- ...rdsOptCatalog && resource.physicalId ? { rdsOptionSettingDefaults: { [resource.physicalId]: rdsOptCatalog } } : {}
1680
+ ...rdsOptCatalog && resource.physicalId ? { rdsOptionSettingDefaults: { [resource.physicalId]: rdsOptCatalog } } : {},
1681
+ ...gaListenerPort ? { siblingListenerPorts: gaListenerPort } : {}
1679
1682
  },
1680
1683
  expected: findings
1681
1684
  }, opts.accountId);
@@ -5410,6 +5413,7 @@ function cloneDeepWithSymbols(v) {
5410
5413
  }
5411
5414
  const isPolicyStatementArray = (arr) => arr.length > 0 && arr.every((el) => isNestedObject(el) && "Effect" in el);
5412
5415
  const isInlinePolicyArray = (arr) => arr.length > 0 && arr.every((el) => isNestedObject(el) && "PolicyDocument" in el);
5416
+ const isKeyValueTagList = (arr) => arr.length > 0 && identityField(arr) === "Key" && arr.every((el) => isNestedObject(el) && "Value" in el);
5413
5417
  function isPolicySubsetOf(sub, sup) {
5414
5418
  for (const [k, v] of Object.entries(sub)) {
5415
5419
  if (!(k in sup)) return false;
@@ -5780,6 +5784,14 @@ function classifyResource(resource, liveRaw, schema, opts = {}) {
5780
5784
  Id: `${attach}_${rtb}`
5781
5785
  };
5782
5786
  }
5787
+ if (resourceType === "AWS::GlobalAccelerator::EndpointGroup") {
5788
+ const listenerArn = declared["ListenerArn"];
5789
+ const port = typeof listenerArn === "string" ? opts.siblingListenerPorts?.[listenerArn] : void 0;
5790
+ if (typeof port === "number") knownDef = {
5791
+ ...knownDef,
5792
+ HealthCheckPort: port
5793
+ };
5794
+ }
5783
5795
  if (resourceType === "AWS::Lambda::EventSourceMapping") {
5784
5796
  const arn = declared["EventSourceArn"];
5785
5797
  const service = typeof arn === "string" ? arn.split(":")[2] : void 0;
@@ -6242,13 +6254,17 @@ function classifyResource(resource, liveRaw, schema, opts = {}) {
6242
6254
  }) ?? false)) continue;
6243
6255
  const transformExpr = schema.propertyTransforms?.[d.path] ?? schema.propertyTransforms?.[d.path.replace(/\.\d+(?=\.|$)/g, ".*")];
6244
6256
  if (transformExpr !== void 0 && matchesPropertyTransform(transformExpr, d.stateValue, resolveParentObject(declared, d.path), declared, d.awsValue, d.path.split(".").at(-1) ?? d.path)) continue;
6257
+ const tagListWhole = !unorderedObjArray && Array.isArray(v) && isKeyValueTagList(v) && d.path.startsWith(`${k}.`);
6245
6258
  const unorderedExtra = unorderedObjArray && Array.isArray(declaredVal) && declaredRemapSource ? {
6246
6259
  path: remapSortedIndexToDeclared(d.path, k, declaredVal, declaredRemapSource),
6247
6260
  wholeArrayRevert: {
6248
6261
  path: k,
6249
6262
  value: v
6250
6263
  }
6251
- } : {};
6264
+ } : tagListWhole ? { wholeArrayRevert: {
6265
+ path: k,
6266
+ value: v
6267
+ } } : {};
6252
6268
  findings.push({
6253
6269
  tier: "declared",
6254
6270
  logicalId,
@@ -7369,12 +7385,18 @@ async function enumerateEventBusChildren(ctx) {
7369
7385
  liveRules
7370
7386
  });
7371
7387
  }
7388
+ const OPENSEARCH_SERVICE_CLIENT_PREFIXES = ["AWSElasticsearch-", "AmazonOpenSearchService-"];
7389
+ function isOpenSearchServiceClient(name) {
7390
+ if (name === void 0) return false;
7391
+ return OPENSEARCH_SERVICE_CLIENT_PREFIXES.some((p) => name.startsWith(p));
7392
+ }
7372
7393
  function diffUserPoolChildren(input) {
7373
7394
  const { userPoolId, declaredClientIds, liveClients } = input;
7374
7395
  const declared = new Set(declaredClientIds);
7375
7396
  const added = [];
7376
7397
  for (const c of liveClients) {
7377
7398
  if (declared.has(c.id)) continue;
7399
+ if (isOpenSearchServiceClient(c.name ?? c.label)) continue;
7378
7400
  added.push({
7379
7401
  resourceType: "AWS::Cognito::UserPoolClient",
7380
7402
  identifier: `${userPoolId}|${c.id}`,
@@ -7527,6 +7549,7 @@ async function enumerateUserPoolChildren(ctx) {
7527
7549
  declaredClientIds,
7528
7550
  liveClients: (await pageUserPoolClients(client, userPoolId)).filter((c) => typeof c.ClientId === "string").map((c) => ({
7529
7551
  id: c.ClientId,
7552
+ name: c.ClientName,
7530
7553
  label: c.ClientName ?? c.ClientId
7531
7554
  }))
7532
7555
  });
@@ -11161,6 +11184,18 @@ function buildSiblingLifecycleHooks(desired) {
11161
11184
  }
11162
11185
  return map;
11163
11186
  }
11187
+ const GA_LISTENER_TYPE = "AWS::GlobalAccelerator::Listener";
11188
+ function buildSiblingListenerPorts(desired) {
11189
+ const map = {};
11190
+ for (const r of desired.resources) {
11191
+ if (r.resourceType !== GA_LISTENER_TYPE || !r.physicalId) continue;
11192
+ const ranges = r.declared?.PortRanges;
11193
+ const first = Array.isArray(ranges) ? ranges[0] : void 0;
11194
+ const from = first && typeof first === "object" ? first.FromPort : void 0;
11195
+ if (typeof from === "number") map[r.physicalId] = from;
11196
+ }
11197
+ return map;
11198
+ }
11164
11199
  function resolvePrincipalKey(ref, byLogicalId) {
11165
11200
  if (typeof ref === "string" && ref) return ref;
11166
11201
  if (ref && typeof ref === "object" && "Ref" in ref) {
@@ -11374,6 +11409,7 @@ async function gatherFindings(stackName, region, templateOverride, recoveryTempl
11374
11409
  siblingManagedPolicyAttachments: buildSiblingManagedPolicyAttachments(desired),
11375
11410
  siblingUserGroups: buildSiblingUserGroups(desired),
11376
11411
  siblingLifecycleHooks: buildSiblingLifecycleHooks(desired),
11412
+ siblingListenerPorts: buildSiblingListenerPorts(desired),
11377
11413
  bucketNotificationManaged: buildBucketNotificationManaged(desired),
11378
11414
  clusterEchoModel: buildClusterEchoModels(desired),
11379
11415
  rdsOptionSettingDefaults: await buildRdsOptionSettingDefaults(desired, region)
@@ -11437,6 +11473,7 @@ async function regatherTouched(gathered, touched, region) {
11437
11473
  siblingManagedPolicyAttachments: buildSiblingManagedPolicyAttachments(desired),
11438
11474
  siblingUserGroups: buildSiblingUserGroups(desired),
11439
11475
  siblingLifecycleHooks: buildSiblingLifecycleHooks(desired),
11476
+ siblingListenerPorts: buildSiblingListenerPorts(desired),
11440
11477
  bucketNotificationManaged: buildBucketNotificationManaged(desired),
11441
11478
  clusterEchoModel: buildClusterEchoModels(desired),
11442
11479
  rdsOptionSettingDefaults: await buildRdsOptionSettingDefaults(desired, region)