cdk-real-drift 0.23.0 → 0.23.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
@@ -1956,6 +1956,7 @@ function buildCorpusCase(resource, liveRaw, schema, opts, findings) {
1956
1956
  region: opts.region,
1957
1957
  kmsAliasTargets: opts.kmsAliasTargets,
1958
1958
  oaiCanonicalIds: opts.oaiCanonicalIds,
1959
+ ...Object.keys(opts.stackTags ?? {}).length > 0 && (Array.isArray(liveRaw.Tags) || Array.isArray(liveRaw.TagSpecifications)) ? { stackTags: opts.stackTags } : {},
1959
1960
  ...sgSibling && resource.physicalId ? { siblingSgRules: { [resource.physicalId]: sgSibling } } : {},
1960
1961
  ...bucketNotif ? { bucketNotificationManaged: bucketNotif } : {},
1961
1962
  ...eipSiblingId ? { siblingEipAssociations: [eipSiblingId] } : {},
@@ -2686,6 +2687,12 @@ const KNOWN_DEFAULTS = {
2686
2687
  TransportProtocol: "udp",
2687
2688
  SessionTimeoutHours: 24
2688
2689
  },
2690
+ "AWS::EC2::CapacityReservation": {
2691
+ Tenancy: "default",
2692
+ EndDateType: "unlimited",
2693
+ EndDate: "null",
2694
+ InstanceMatchCriteria: "open"
2695
+ },
2689
2696
  "AWS::DAX::Cluster": {
2690
2697
  ClusterEndpointEncryptionType: "NONE",
2691
2698
  ParameterGroupName: "default.dax1.0"
@@ -3709,6 +3716,7 @@ const VALUE_INDEPENDENT_DEFAULT_TOPLEVEL_PATHS = {
3709
3716
  "AWS::AmazonMQ::Broker": new Set(["MaintenanceWindowStartTime", "SubnetIds"]),
3710
3717
  "AWS::EC2::InstanceConnectEndpoint": new Set(["SecurityGroupIds"]),
3711
3718
  "AWS::EC2::EIPAssociation": new Set(["PrivateIpAddress", "EIP"]),
3719
+ "AWS::EC2::CapacityReservation": new Set(["AvailabilityZoneId"]),
3712
3720
  "AWS::EC2::Instance": new Set([
3713
3721
  "PrivateIpAddress",
3714
3722
  "CpuOptions",
@@ -3929,14 +3937,16 @@ const ELB_TG_ATTRIBUTE_DEFAULTS_BY_PROTOCOL = {
3929
3937
  "deregistration_delay.connection_termination.enabled": "true",
3930
3938
  "proxy_protocol_v2.enabled": "false",
3931
3939
  "target_health_state.unhealthy.connection_termination.enabled": "true",
3932
- "target_health_state.unhealthy.draining_interval_seconds": "0"
3940
+ "target_health_state.unhealthy.draining_interval_seconds": "0",
3941
+ "preserve_client_ip.enabled": "true"
3933
3942
  },
3934
3943
  TCP_UDP: {
3935
3944
  "stickiness.type": "source_ip",
3936
3945
  "deregistration_delay.connection_termination.enabled": "true",
3937
3946
  "proxy_protocol_v2.enabled": "false",
3938
3947
  "target_health_state.unhealthy.connection_termination.enabled": "true",
3939
- "target_health_state.unhealthy.draining_interval_seconds": "0"
3948
+ "target_health_state.unhealthy.draining_interval_seconds": "0",
3949
+ "preserve_client_ip.enabled": "true"
3940
3950
  }
3941
3951
  };
3942
3952
  const ELB_TG_ATTRIBUTE_DEFAULTS_BY_TARGET_TYPE = {
@@ -4267,6 +4277,7 @@ function isEpochHourEqual(a, b) {
4267
4277
  const hb = sec(b);
4268
4278
  return ha !== void 0 && hb !== void 0 && ha === hb;
4269
4279
  }
4280
+ const NUMERIC_STRING_EQUAL_PATHS = { "AWS::Budgets::Budget": [/(?:^|\.)BudgetLimit\.Amount$/, /(?:^|\.)PlannedBudgetLimits\.[^.]+\.Amount$/] };
4270
4281
  const TRAILING_DOT_PATHS = {
4271
4282
  "AWS::Route53::HostedZone": new Set(["Name"]),
4272
4283
  "AWS::Route53::RecordSet": new Set(["Name"]),
@@ -5797,30 +5808,62 @@ function canonicalizeBaselineForCompare(v, resourceType, path) {
5797
5808
  //#region src/normalize/stack-tags.ts
5798
5809
  const declaredTagKeys = (declared) => {
5799
5810
  const out = /* @__PURE__ */ new Set();
5800
- const tags = declared?.Tags;
5801
- if (Array.isArray(tags)) for (const t of tags) {
5802
- const k = t?.Key;
5803
- if (typeof k === "string") out.add(k);
5804
- }
5811
+ const collect = (tags) => {
5812
+ if (!Array.isArray(tags)) return;
5813
+ for (const t of tags) {
5814
+ const k = t?.Key;
5815
+ if (typeof k === "string") out.add(k);
5816
+ }
5817
+ };
5818
+ const d = declared;
5819
+ collect(d?.Tags);
5820
+ const specs = d?.TagSpecifications;
5821
+ if (Array.isArray(specs)) for (const spec of specs) collect(spec?.Tags);
5805
5822
  return out;
5806
5823
  };
5807
5824
  const subtractPropagatedStackTags = (live, stackTags, declaredKeys) => {
5808
5825
  if (Object.keys(stackTags).length === 0) return live;
5809
- const tags = live.Tags;
5810
- if (!Array.isArray(tags)) return live;
5811
- const filtered = tags.filter((t) => {
5826
+ const keepTag = (t) => {
5812
5827
  if (!t || typeof t !== "object") return true;
5813
5828
  const key = t.Key;
5814
5829
  const value = t.Value;
5815
5830
  if (typeof key !== "string") return true;
5816
5831
  if (declaredKeys.has(key)) return true;
5817
5832
  return !(key in stackTags && stackTags[key] === value);
5818
- });
5819
- if (filtered.length === tags.length) return live;
5820
- return {
5821
- ...live,
5822
- Tags: filtered
5823
5833
  };
5834
+ let out = live;
5835
+ const tags = live.Tags;
5836
+ if (Array.isArray(tags)) {
5837
+ const filtered = tags.filter(keepTag);
5838
+ if (filtered.length !== tags.length) out = {
5839
+ ...out,
5840
+ Tags: filtered
5841
+ };
5842
+ }
5843
+ const specs = out.TagSpecifications;
5844
+ if (Array.isArray(specs)) {
5845
+ let changed = false;
5846
+ const filteredSpecs = specs.map((spec) => {
5847
+ const specTags = spec?.Tags;
5848
+ if (!Array.isArray(specTags)) return spec;
5849
+ const filtered = specTags.filter(keepTag);
5850
+ if (filtered.length === specTags.length) return spec;
5851
+ changed = true;
5852
+ return {
5853
+ ...spec,
5854
+ Tags: filtered
5855
+ };
5856
+ }).filter((spec) => {
5857
+ const specTags = spec?.Tags;
5858
+ return !(Array.isArray(specTags) && specTags.length === 0);
5859
+ });
5860
+ if (changed || filteredSpecs.length !== specs.length) {
5861
+ out = { ...out };
5862
+ if (filteredSpecs.length === 0) delete out.TagSpecifications;
5863
+ else out.TagSpecifications = filteredSpecs;
5864
+ }
5865
+ }
5866
+ return out;
5824
5867
  };
5825
5868
 
5826
5869
  //#endregion
@@ -5919,8 +5962,8 @@ function elbAttributeDefaultsFor(resourceType, declared, live) {
5919
5962
  const targetType = declared.TargetType ?? live.TargetType;
5920
5963
  return {
5921
5964
  ...shared,
5922
- ...typeof protocol === "string" ? ELB_TG_ATTRIBUTE_DEFAULTS_BY_PROTOCOL[protocol] ?? {} : {},
5923
- ...typeof targetType === "string" ? ELB_TG_ATTRIBUTE_DEFAULTS_BY_TARGET_TYPE[targetType] ?? {} : {}
5965
+ ...typeof targetType === "string" ? ELB_TG_ATTRIBUTE_DEFAULTS_BY_TARGET_TYPE[targetType] ?? {} : {},
5966
+ ...typeof protocol === "string" ? ELB_TG_ATTRIBUTE_DEFAULTS_BY_PROTOCOL[protocol] ?? {} : {}
5924
5967
  };
5925
5968
  }
5926
5969
  return shared;
@@ -7681,6 +7724,7 @@ function classifyResource(resource, liveRaw, schema, opts = {}) {
7681
7724
  if (CASE_INSENSITIVE_KEY_PATHS[resourceType]?.has(d.path.replace(/\.\d+(?=\.)/g, "[]")) && isCaseInsensitiveKeyMapEqual(d.stateValue, d.awsValue)) continue;
7682
7725
  if (RATE_EXPRESSION_PATHS[resourceType]?.has(d.path) && isEquivalentRateExpression(d.stateValue, d.awsValue)) continue;
7683
7726
  if (EPOCH_HOUR_PATHS[resourceType]?.has(d.path) && isEpochHourEqual(d.stateValue, d.awsValue)) continue;
7727
+ if (NUMERIC_STRING_EQUAL_PATHS[resourceType]?.some((re) => re.test(d.path)) && isNumericStringEqualScalar(d.stateValue, d.awsValue)) continue;
7684
7728
  if (TRAILING_DOT_PATHS[resourceType]?.has(d.path) && isTrailingDotEqual(d.stateValue, d.awsValue)) continue;
7685
7729
  if (TRAILING_SLASH_PATHS[resourceType]?.has(d.path) && isTrailingSlashEqual(d.stateValue, d.awsValue)) continue;
7686
7730
  if (VERSION_PREFIX_PATHS[resourceType]?.has(d.path) && isVersionPrefixMatch(d.stateValue, d.awsValue)) continue;
@@ -11654,7 +11698,7 @@ const readBudget = async ({ physicalId, declared, accountId, region }) => {
11654
11698
  BudgetName: b.BudgetName,
11655
11699
  BudgetType: b.BudgetType,
11656
11700
  TimeUnit: b.TimeUnit,
11657
- ...b.BudgetLimit !== void 0 && { BudgetLimit: b.BudgetLimit },
11701
+ ...b.BudgetLimit !== void 0 && !aad && b.PlannedBudgetLimits === void 0 && { BudgetLimit: b.BudgetLimit },
11658
11702
  ...b.PlannedBudgetLimits !== void 0 && { PlannedBudgetLimits: b.PlannedBudgetLimits },
11659
11703
  ...b.CostFilters !== void 0 && { CostFilters: b.CostFilters },
11660
11704
  ...b.CostTypes !== void 0 && { CostTypes: b.CostTypes },
@@ -19441,6 +19485,8 @@ const CC_REVERTABLE_DESPITE_READ_OVERRIDE = new Set([
19441
19485
  "AWS::EC2::EIP"
19442
19486
  ]);
19443
19487
  const REVERT_SET_DEFAULT_PATHS = new Set([
19488
+ "AWS::EC2::CapacityReservation\0InstanceMatchCriteria",
19489
+ "AWS::EC2::CapacityReservation\0EndDateType",
19444
19490
  "AWS::DLM::LifecyclePolicy\0RetainInterval",
19445
19491
  "AWS::DLM::LifecyclePolicy\0CreateInterval",
19446
19492
  "AWS::IAM::Role\0MaxSessionDuration",