cdk-real-drift 0.2.1 → 0.2.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/dist/cli.js CHANGED
@@ -2061,7 +2061,7 @@ const VALUE_INDEPENDENT_DEFAULT_TOPLEVEL_PATHS = {
2061
2061
  "AWS::KinesisAnalyticsV2::Application": new Set(["ApplicationMaintenanceConfiguration"]),
2062
2062
  "AWS::ElasticBeanstalk::ConfigurationTemplate": new Set(["PlatformArn"]),
2063
2063
  "AWS::ElasticBeanstalk::Environment": new Set(["PlatformArn"]),
2064
- "AWS::ElasticLoadBalancing::LoadBalancer": new Set(["AvailabilityZones"]),
2064
+ "AWS::ElasticLoadBalancing::LoadBalancer": new Set(["AvailabilityZones", "Policies"]),
2065
2065
  "AWS::ApiGateway::Authorizer": new Set(["AuthType"]),
2066
2066
  "AWS::RDS::DBCluster": new Set([
2067
2067
  "KmsKeyId",
@@ -3729,6 +3729,16 @@ function normalizeLiveModel(liveRaw, schema, opts = {}) {
3729
3729
  if (opts.resourceType) sortUnorderedSetProps(live, opts.resourceType, (schema.unorderedObjectArrayPaths ?? []).filter((p) => !p.includes(".")));
3730
3730
  return live;
3731
3731
  }
3732
+ function remapSortedIndexToDeclared(path, arrayKey, sortedDeclared, rawDeclared) {
3733
+ const prefix = `${arrayKey}.`;
3734
+ if (!path.startsWith(prefix)) return path;
3735
+ const m = /^(\d+)(\..*|)$/.exec(path.slice(prefix.length));
3736
+ if (!m) return path;
3737
+ const el = sortedDeclared[Number(m[1])];
3738
+ if (el === void 0) return path;
3739
+ const rawIdx = rawDeclared.findIndex((e) => deepEqual(e, el));
3740
+ return rawIdx < 0 ? path : `${arrayKey}.${rawIdx}${m[2]}`;
3741
+ }
3732
3742
  function classifyResource(resource, liveRaw, schema, opts = {}) {
3733
3743
  const { logicalId, resourceType, physicalId, declared: declaredIn } = resource;
3734
3744
  const findings = [];
@@ -4072,6 +4082,13 @@ function classifyResource(resource, liveRaw, schema, opts = {}) {
4072
4082
  if (INTELLIGENT_TIERING_PATHS[resourceType]?.has(d.path) && isIntelligentTieringMatch(d.stateValue, d.awsValue)) continue;
4073
4083
  if ((UNORDERED_ARRAY_PROPS[resourceType]?.has(d.path) || UNORDERED_ARRAY_PROPS[resourceType]?.has(d.path.replace(/\.\d+(?=\.|$)/g, ".*")) || schema.unorderedScalarPaths?.includes(d.path)) && isEqualUnorderedScalarSet(d.stateValue, d.awsValue)) continue;
4074
4084
  if (isTrivialEmpty(d.stateValue) && d.path in knownDef && deepEqual(d.awsValue, knownDef[d.path])) continue;
4085
+ const unorderedExtra = unorderedObjArray && Array.isArray(declaredVal) && Array.isArray(v) ? {
4086
+ path: remapSortedIndexToDeclared(d.path, k, declaredVal, v),
4087
+ wholeArrayRevert: {
4088
+ path: k,
4089
+ value: v
4090
+ }
4091
+ } : {};
4075
4092
  findings.push({
4076
4093
  tier: "declared",
4077
4094
  logicalId,
@@ -4079,10 +4096,7 @@ function classifyResource(resource, liveRaw, schema, opts = {}) {
4079
4096
  path: d.path,
4080
4097
  desired: d.stateValue,
4081
4098
  actual: d.awsValue,
4082
- ...unorderedObjArray ? { wholeArrayRevert: {
4083
- path: k,
4084
- value: v
4085
- } } : {}
4099
+ ...unorderedExtra
4086
4100
  });
4087
4101
  }
4088
4102
  }