cdk-real-drift 0.17.1 → 0.17.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
@@ -1922,6 +1922,8 @@ function buildCorpusCase(resource, liveRaw, schema, opts, findings) {
1922
1922
  const gaListenerPort = typeof listenerArn === "string" && opts.siblingListenerPorts?.[listenerArn] !== void 0 ? { [listenerArn]: opts.siblingListenerPorts[listenerArn] } : void 0;
1923
1923
  const dmsClass = resource.resourceType === "AWS::DMS::ReplicationInstance" ? resource.declared?.ReplicationInstanceClass : void 0;
1924
1924
  const dmsStorageDefault = typeof dmsClass === "string" && opts.accountDefaults?.dmsAllocatedStorageDefaults?.[dmsClass] !== void 0 ? { dmsAllocatedStorageDefaults: { [dmsClass]: opts.accountDefaults.dmsAllocatedStorageDefaults[dmsClass] } } : void 0;
1925
+ const cvpnVpcMap = opts.siblingClientVpnEndpointVpcs;
1926
+ const cvpnVpcKey = resource.resourceType !== "AWS::EC2::ClientVpnEndpoint" || cvpnVpcMap === void 0 ? void 0 : resource.logicalId in cvpnVpcMap ? resource.logicalId : resource.physicalId !== void 0 && resource.physicalId in cvpnVpcMap ? resource.physicalId : void 0;
1925
1927
  return sanitizeAccountId({
1926
1928
  corpusVersion: 1,
1927
1929
  resource: {
@@ -1959,7 +1961,8 @@ function buildCorpusCase(resource, liveRaw, schema, opts, findings) {
1959
1961
  ...echoModel && resource.physicalId ? { clusterEchoModel: { [resource.physicalId]: echoModel } } : {},
1960
1962
  ...rdsOptCatalog && resource.physicalId ? { rdsOptionSettingDefaults: { [resource.physicalId]: rdsOptCatalog } } : {},
1961
1963
  ...gaListenerPort ? { siblingListenerPorts: gaListenerPort } : {},
1962
- ...dmsStorageDefault ? { accountDefaults: dmsStorageDefault } : {}
1964
+ ...dmsStorageDefault ? { accountDefaults: dmsStorageDefault } : {},
1965
+ ...cvpnVpcKey !== void 0 && cvpnVpcMap !== void 0 ? { siblingClientVpnEndpointVpcs: { [cvpnVpcKey]: cvpnVpcMap[cvpnVpcKey] ?? null } } : {}
1963
1966
  },
1964
1967
  expected: findings
1965
1968
  }, opts.accountId);
@@ -5831,7 +5834,8 @@ const DEFAULT_SG_LIST_PATHS = {
5831
5834
  "AWS::RedshiftServerless::Workgroup": "SecurityGroupIds",
5832
5835
  "AWS::EC2::Instance": "SecurityGroupIds",
5833
5836
  "AWS::DAX::Cluster": "SecurityGroupIds",
5834
- "AWS::DMS::ReplicationInstance": "VpcSecurityGroupIds"
5837
+ "AWS::DMS::ReplicationInstance": "VpcSecurityGroupIds",
5838
+ "AWS::EC2::ClientVpnEndpoint": "SecurityGroupIds"
5835
5839
  };
5836
5840
  /** #1269 fold decision for an UNDECLARED default-SUBNET list (RedshiftServerless Workgroup
5837
5841
  * SubnetIds). Unlike the SG gate (which folds only a SINGLE default SG), a workgroup placed into
@@ -7480,6 +7484,20 @@ function classifyResource(resource, liveRaw, schema, opts = {}) {
7480
7484
  });
7481
7485
  continue;
7482
7486
  }
7487
+ if (resourceType === "AWS::EC2::ClientVpnEndpoint" && k === "VpcId" && typeof v === "string") {
7488
+ const vpcMap = opts.siblingClientVpnEndpointVpcs;
7489
+ const derived = vpcMap === void 0 ? void 0 : logicalId in vpcMap ? vpcMap[logicalId] : physicalId !== void 0 && physicalId in vpcMap ? vpcMap[physicalId] : void 0;
7490
+ if (derived !== void 0) {
7491
+ findings.push({
7492
+ tier: derived === null || derived === v ? "atDefault" : "undeclared",
7493
+ logicalId,
7494
+ resourceType,
7495
+ path: k,
7496
+ actual: v
7497
+ });
7498
+ continue;
7499
+ }
7500
+ }
7483
7501
  if (DEFAULT_SUBNET_LIST_PATHS[resourceType] === k && !isTrivialEmpty(v)) {
7484
7502
  findings.push({
7485
7503
  tier: shouldFoldDefaultSubnetList(resourceType, k, v, opts.defaultSubnetIds) ? "atDefault" : "undeclared",
@@ -13920,7 +13938,8 @@ const DEFAULT_SG_LIST_TYPES = new Set([
13920
13938
  "AWS::DocDB::DBCluster",
13921
13939
  "AWS::EC2::Instance",
13922
13940
  "AWS::DAX::Cluster",
13923
- "AWS::DMS::ReplicationInstance"
13941
+ "AWS::DMS::ReplicationInstance",
13942
+ "AWS::EC2::ClientVpnEndpoint"
13924
13943
  ]);
13925
13944
  const DEFAULT_SUBNET_LIST_TYPES = new Set(["AWS::RedshiftServerless::Workgroup"]);
13926
13945
  const defaultSgIdsCache = /* @__PURE__ */ new Map();
@@ -14436,6 +14455,50 @@ function buildSiblingEipAssociations(desired) {
14436
14455
  }
14437
14456
  return associated;
14438
14457
  }
14458
+ function buildClientVpnEndpointSiblingVpcs(desired) {
14459
+ const refLogicalId = (ref) => {
14460
+ if (ref && typeof ref === "object") {
14461
+ if ("Ref" in ref && typeof ref.Ref === "string") return ref.Ref;
14462
+ if ("Fn::GetAtt" in ref) {
14463
+ const g = ref["Fn::GetAtt"];
14464
+ if (Array.isArray(g) && typeof g[0] === "string") return g[0];
14465
+ }
14466
+ }
14467
+ };
14468
+ const endpointIds = /* @__PURE__ */ new Map();
14469
+ const subnetVpcRaw = /* @__PURE__ */ new Map();
14470
+ const vpcPhysical = /* @__PURE__ */ new Map();
14471
+ for (const r of desired.resources) if (r.resourceType === "AWS::EC2::ClientVpnEndpoint") {
14472
+ const ids = [r.logicalId];
14473
+ if (r.physicalId) ids.push(r.physicalId);
14474
+ endpointIds.set(r.logicalId, ids);
14475
+ } else if (r.resourceType === "AWS::EC2::Subnet") {
14476
+ const raw = r.declared?.VpcId;
14477
+ subnetVpcRaw.set(r.logicalId, raw);
14478
+ if (r.physicalId) subnetVpcRaw.set(r.physicalId, raw);
14479
+ } else if (r.resourceType === "AWS::EC2::VPC" && r.physicalId) vpcPhysical.set(r.logicalId, r.physicalId);
14480
+ const out = {};
14481
+ for (const r of desired.resources) {
14482
+ if (r.resourceType !== "AWS::EC2::ClientVpnTargetNetworkAssociation") continue;
14483
+ const d = r.declared ?? {};
14484
+ const epLogical = refLogicalId(d.ClientVpnEndpointId);
14485
+ const epKeys = epLogical !== void 0 ? endpointIds.get(epLogical) ?? [] : typeof d.ClientVpnEndpointId === "string" && d.ClientVpnEndpointId ? [d.ClientVpnEndpointId] : [];
14486
+ if (epKeys.length === 0) continue;
14487
+ const subnetKey = refLogicalId(d.SubnetId) ?? (typeof d.SubnetId === "string" ? d.SubnetId : "");
14488
+ const rawVpc = subnetVpcRaw.get(subnetKey);
14489
+ let derived = null;
14490
+ if (typeof rawVpc === "string" && rawVpc) derived = rawVpc;
14491
+ else {
14492
+ const vpcLogical = refLogicalId(rawVpc);
14493
+ if (vpcLogical !== void 0) derived = vpcPhysical.get(vpcLogical) ?? null;
14494
+ }
14495
+ for (const key of epKeys) {
14496
+ if (key in out && out[key] !== derived) derived = null;
14497
+ out[key] = derived;
14498
+ }
14499
+ }
14500
+ return out;
14501
+ }
14439
14502
  function buildSiblingSubnetCidrBlocks(desired) {
14440
14503
  const subnetIdentities = /* @__PURE__ */ new Map();
14441
14504
  for (const r of desired.resources) {
@@ -14862,6 +14925,7 @@ async function gatherFindings(stackName, region, templateOverride, recoveryTempl
14862
14925
  bucketNotificationConfigs: buildBucketNotificationConfigs(desired),
14863
14926
  clusterEchoModel: buildClusterEchoModels(desired),
14864
14927
  scalableTargetBands: buildScalableTargetBands(desired),
14928
+ siblingClientVpnEndpointVpcs: buildClientVpnEndpointSiblingVpcs(desired),
14865
14929
  rdsOptionSettingDefaults: await buildRdsOptionSettingDefaults(desired, region)
14866
14930
  };
14867
14931
  const corpusDir = process.env[CORPUS_DIR_ENV];
@@ -14938,6 +15002,7 @@ async function regatherTouched(gathered, touched, region) {
14938
15002
  bucketNotificationConfigs: buildBucketNotificationConfigs(desired),
14939
15003
  clusterEchoModel: buildClusterEchoModels(desired),
14940
15004
  scalableTargetBands: buildScalableTargetBands(desired),
15005
+ siblingClientVpnEndpointVpcs: buildClientVpnEndpointSiblingVpcs(desired),
14941
15006
  rdsOptionSettingDefaults: await buildRdsOptionSettingDefaults(desired, region)
14942
15007
  };
14943
15008
  const fresh = [];
@@ -18552,7 +18617,8 @@ const REVERT_SET_DEFAULT_PATHS = new Set([
18552
18617
  "AWS::Redshift::Cluster\0AllowVersionUpgrade",
18553
18618
  "AWS::DAX::ParameterGroup\0ParameterNameValues",
18554
18619
  "AWS::ApiGatewayV2::IntegrationResponse\0TemplateSelectionExpression",
18555
- "AWS::ApiGatewayV2::RouteResponse\0ModelSelectionExpression"
18620
+ "AWS::ApiGatewayV2::RouteResponse\0ModelSelectionExpression",
18621
+ "AWS::Kinesis::Stream\0RetentionPeriodHours"
18556
18622
  ]);
18557
18623
  const REVERT_SET_DEFAULT_VALUES = {
18558
18624
  "AWS::EC2::Subnet\0EnableDns64": false,