cdk-real-drift 0.13.12 → 0.13.13

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
@@ -3695,7 +3695,10 @@ const ELB_ATTRIBUTE_DEFAULTS = {
3695
3695
  "zonal_shift.config.enabled": "false",
3696
3696
  "ipv6.deny_all_igw_traffic": "false"
3697
3697
  },
3698
- "AWS::ElasticLoadBalancingV2::Listener": { "routing.http.response.server.enabled": "true" },
3698
+ "AWS::ElasticLoadBalancingV2::Listener": {
3699
+ "routing.http.response.server.enabled": "true",
3700
+ "tcp.idle_timeout.seconds": "350"
3701
+ },
3699
3702
  "AWS::ElasticLoadBalancingV2::TargetGroup": {
3700
3703
  "deregistration_delay.timeout_seconds": "300",
3701
3704
  "lambda.multi_value_headers.enabled": "false",
@@ -3717,6 +3720,34 @@ const ELB_ATTRIBUTE_DEFAULTS_BY_LB_TYPE = {
3717
3720
  network: { "load_balancing.cross_zone.enabled": "false" },
3718
3721
  gateway: { "load_balancing.cross_zone.enabled": "false" }
3719
3722
  };
3723
+ const ELB_TG_ATTRIBUTE_DEFAULTS_BY_PROTOCOL = {
3724
+ GENEVE: {
3725
+ "stickiness.type": "source_ip_dest_ip_proto",
3726
+ "target_failover.on_deregistration": "no_rebalance",
3727
+ "target_failover.on_unhealthy": "no_rebalance"
3728
+ },
3729
+ TCP: {
3730
+ "stickiness.type": "source_ip",
3731
+ "deregistration_delay.connection_termination.enabled": "false",
3732
+ "proxy_protocol_v2.enabled": "false"
3733
+ },
3734
+ TLS: {
3735
+ "stickiness.type": "source_ip",
3736
+ "deregistration_delay.connection_termination.enabled": "false",
3737
+ "proxy_protocol_v2.enabled": "false"
3738
+ },
3739
+ UDP: {
3740
+ "stickiness.type": "source_ip",
3741
+ "deregistration_delay.connection_termination.enabled": "false",
3742
+ "proxy_protocol_v2.enabled": "false"
3743
+ },
3744
+ TCP_UDP: {
3745
+ "stickiness.type": "source_ip",
3746
+ "deregistration_delay.connection_termination.enabled": "false",
3747
+ "proxy_protocol_v2.enabled": "false"
3748
+ }
3749
+ };
3750
+ const ELB_TG_ATTRIBUTE_DEFAULTS_BY_TARGET_TYPE = { alb: { "preserve_client_ip.enabled": "true" } };
3720
3751
  const SENTINEL_UNPARSEABLE = Symbol("unparseable");
3721
3752
  function deepCompareUnordered(a, b) {
3722
3753
  if (a === b) return true;
@@ -5637,6 +5668,26 @@ function hasPathUnsafeKey(o) {
5637
5668
 
5638
5669
  //#endregion
5639
5670
  //#region src/diff/classify.ts
5671
+ function elbAttributeDefaultsFor(resourceType, declared, live) {
5672
+ const shared = ELB_ATTRIBUTE_DEFAULTS[resourceType] ?? {};
5673
+ if (resourceType === "AWS::ElasticLoadBalancingV2::LoadBalancer") {
5674
+ const lbType = String(live.Type ?? declared.Type ?? "application");
5675
+ return {
5676
+ ...shared,
5677
+ ...ELB_ATTRIBUTE_DEFAULTS_BY_LB_TYPE[lbType] ?? {}
5678
+ };
5679
+ }
5680
+ if (resourceType === "AWS::ElasticLoadBalancingV2::TargetGroup") {
5681
+ const protocol = declared.Protocol ?? live.Protocol;
5682
+ const targetType = declared.TargetType ?? live.TargetType;
5683
+ return {
5684
+ ...shared,
5685
+ ...typeof protocol === "string" ? ELB_TG_ATTRIBUTE_DEFAULTS_BY_PROTOCOL[protocol] ?? {} : {},
5686
+ ...typeof targetType === "string" ? ELB_TG_ATTRIBUTE_DEFAULTS_BY_TARGET_TYPE[targetType] ?? {} : {}
5687
+ };
5688
+ }
5689
+ return shared;
5690
+ }
5640
5691
  const ELB_ATTRIBUTE_BAGS = {
5641
5692
  "AWS::ElasticLoadBalancingV2::LoadBalancer": "LoadBalancerAttributes",
5642
5693
  "AWS::ElasticLoadBalancingV2::TargetGroup": "TargetGroupAttributes",
@@ -6005,6 +6056,16 @@ function alignCompositeKeySubset(declared, live, spec) {
6005
6056
  });
6006
6057
  }
6007
6058
  const isNestedObject = (x) => x !== null && typeof x === "object" && !Array.isArray(x);
6059
+ function nicZeroGroupSetEquals(declaredNics, liveSgIds) {
6060
+ if (!Array.isArray(declaredNics)) return false;
6061
+ const nic0 = declaredNics.find((n) => n !== null && typeof n === "object" && (n.DeviceIndex === "0" || n.DeviceIndex === 0));
6062
+ if (nic0 === void 0) return false;
6063
+ const groupSet = nic0.GroupSet;
6064
+ if (!Array.isArray(groupSet) || groupSet.length !== liveSgIds.length) return false;
6065
+ if (!groupSet.every((g) => typeof g === "string") || !liveSgIds.every((g) => typeof g === "string")) return false;
6066
+ const live = new Set(liveSgIds);
6067
+ return groupSet.length === live.size && groupSet.every((g) => live.has(g));
6068
+ }
6008
6069
  const DDB_TABLE_TYPES = new Set(["AWS::DynamoDB::Table", "AWS::DynamoDB::GlobalTable"]);
6009
6070
  function capacityUnit(x) {
6010
6071
  if (typeof x === "number") return x;
@@ -6651,12 +6712,17 @@ function classifyResource(resource, liveRaw, schema, opts = {}) {
6651
6712
  if (resourceType === "AWS::ElasticLoadBalancingV2::TargetGroup") {
6652
6713
  const targetType = declaredIn?.["TargetType"];
6653
6714
  const protocolVersion = declaredIn?.["ProtocolVersion"] ?? live["ProtocolVersion"];
6715
+ const protocol = declaredIn?.["Protocol"] ?? live["Protocol"];
6654
6716
  knownDef = {
6655
6717
  ...knownDef,
6656
6718
  HealthyThresholdCount: 5,
6657
- HealthCheckIntervalSeconds: targetType === "lambda" ? 35 : 30,
6719
+ HealthCheckIntervalSeconds: targetType === "lambda" ? 35 : protocol === "GENEVE" ? 10 : 30,
6658
6720
  HealthCheckPath: protocolVersion === "GRPC" ? "/AWS.ALB/healthcheck" : "/",
6659
6721
  ...targetType === "lambda" ? { HealthCheckTimeoutSeconds: 30 } : {},
6722
+ ...targetType === "alb" ? {
6723
+ HealthCheckTimeoutSeconds: 6,
6724
+ Matcher: { HttpCode: "200-399" }
6725
+ } : {},
6660
6726
  ...protocolVersion === "GRPC" ? { Matcher: { GrpcCode: "12" } } : {}
6661
6727
  };
6662
6728
  }
@@ -7095,11 +7161,7 @@ function classifyResource(resource, liveRaw, schema, opts = {}) {
7095
7161
  });
7096
7162
  }
7097
7163
  const declaredKeys = new Set(v.filter(isKeyValueEntry).map((e) => e.Key));
7098
- const lbType = resourceType === "AWS::ElasticLoadBalancingV2::LoadBalancer" ? String(live.Type ?? declared.Type ?? "application") : void 0;
7099
- const attrDefaults = {
7100
- ...ELB_ATTRIBUTE_DEFAULTS[resourceType] ?? {},
7101
- ...lbType === void 0 ? {} : ELB_ATTRIBUTE_DEFAULTS_BY_LB_TYPE[lbType] ?? {}
7102
- };
7164
+ const attrDefaults = elbAttributeDefaultsFor(resourceType, declared, live);
7103
7165
  for (const lEl of liveBag) {
7104
7166
  if (!isKeyValueEntry(lEl)) continue;
7105
7167
  const key = lEl.Key;
@@ -7296,11 +7358,7 @@ function classifyResource(resource, liveRaw, schema, opts = {}) {
7296
7358
  for (const [k, v] of Object.entries(live)) {
7297
7359
  if (k in declared) continue;
7298
7360
  if (k === ELB_ATTRIBUTE_BAGS[resourceType] && Array.isArray(v)) {
7299
- const lbType = resourceType === "AWS::ElasticLoadBalancingV2::LoadBalancer" ? String(live.Type ?? declared.Type ?? "application") : void 0;
7300
- const attrDefaults = {
7301
- ...ELB_ATTRIBUTE_DEFAULTS[resourceType] ?? {},
7302
- ...lbType === void 0 ? {} : ELB_ATTRIBUTE_DEFAULTS_BY_LB_TYPE[lbType] ?? {}
7303
- };
7361
+ const attrDefaults = elbAttributeDefaultsFor(resourceType, declared, live);
7304
7362
  for (const lEl of v) {
7305
7363
  if (!isKeyValueEntry(lEl)) continue;
7306
7364
  const key = lEl.Key;
@@ -7328,6 +7386,16 @@ function classifyResource(resource, liveRaw, schema, opts = {}) {
7328
7386
  });
7329
7387
  continue;
7330
7388
  }
7389
+ if (resourceType === "AWS::EC2::Instance" && k === "SecurityGroupIds" && Array.isArray(v) && nicZeroGroupSetEquals(declared.NetworkInterfaces, v)) {
7390
+ findings.push({
7391
+ tier: "atDefault",
7392
+ logicalId,
7393
+ resourceType,
7394
+ path: k,
7395
+ actual: v
7396
+ });
7397
+ continue;
7398
+ }
7331
7399
  if (DEFAULT_SG_LIST_PATHS[resourceType] === k && !isTrivialEmpty(v)) {
7332
7400
  findings.push({
7333
7401
  tier: shouldFoldDefaultSgList(resourceType, k, v, opts.defaultSgIds) ? "atDefault" : "undeclared",
@@ -9639,6 +9707,7 @@ async function enumerateListenerChildren(ctx) {
9639
9707
  const { parent, desired, region } = ctx;
9640
9708
  const listenerArn = parent.physicalId;
9641
9709
  if (!listenerArn) return [];
9710
+ if (listenerArn.includes(":listener/gwy/")) return [];
9642
9711
  const declaredRuleArns = [];
9643
9712
  for (const r of desired.resources) if (r.resourceType === "AWS::ElasticLoadBalancingV2::ListenerRule" && parentRefMatches(r.declared.ListenerArn, listenerArn) && r.physicalId) declaredRuleArns.push(r.physicalId);
9644
9713
  return diffListenerChildren({
@@ -9807,6 +9876,10 @@ async function pageSubnets(client, vpcId) {
9807
9876
  } while (next);
9808
9877
  return out;
9809
9878
  }
9879
+ const SERVICE_MANAGED_VPCE_TAG_KEYS = new Set(["AWSMSKManaged"]);
9880
+ function isServiceManagedVpcEndpoint(e) {
9881
+ return (e.Tags ?? []).some((t) => typeof t.Key === "string" && SERVICE_MANAGED_VPCE_TAG_KEYS.has(t.Key));
9882
+ }
9810
9883
  async function pageVpcEndpoints(client, vpcId) {
9811
9884
  const out = [];
9812
9885
  let next;
@@ -9909,7 +9982,7 @@ async function enumerateVpcChildren(ctx) {
9909
9982
  id: s.SubnetId,
9910
9983
  label: s.CidrBlock ? `${s.CidrBlock}` : s.SubnetId
9911
9984
  }));
9912
- const liveEndpoints = (await pageVpcEndpoints(client, vpcId)).filter((e) => typeof e.VpcEndpointId === "string").map((e) => ({
9985
+ const liveEndpoints = (await pageVpcEndpoints(client, vpcId)).filter((e) => typeof e.VpcEndpointId === "string").filter((e) => !isServiceManagedVpcEndpoint(e)).map((e) => ({
9913
9986
  id: e.VpcEndpointId,
9914
9987
  label: e.ServiceName ?? e.VpcEndpointId
9915
9988
  }));
@@ -17826,6 +17899,7 @@ const REVERT_SET_DEFAULT_PATHS = new Set([
17826
17899
  "AWS::EC2::NetworkInterface\0SourceDestCheck",
17827
17900
  "AWS::EC2::Instance\0SourceDestCheck",
17828
17901
  "AWS::EC2::Instance\0InstanceInitiatedShutdownBehavior",
17902
+ "AWS::EC2::Instance\0MetadataOptions",
17829
17903
  "AWS::EC2::ClientVpnEndpoint\0VpnPort",
17830
17904
  "AWS::EC2::ClientVpnEndpoint\0DisconnectOnSessionTimeout",
17831
17905
  "AWS::EC2::ClientVpnEndpoint\0SessionTimeoutHours",