cdk-real-drift 0.2.23 → 0.2.25

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
@@ -1778,7 +1778,17 @@ const KNOWN_DEFAULT_PATHS = {
1778
1778
  "AttributeMapping.username": "sub"
1779
1779
  },
1780
1780
  "AWS::ApiGateway::RestApi": { "EndpointConfiguration.IpAddressType": "ipv4" },
1781
- "AWS::DynamoDB::Table": { "PointInTimeRecoverySpecification.RecoveryPeriodInDays": 35 },
1781
+ "AWS::DynamoDB::Table": {
1782
+ "PointInTimeRecoverySpecification.RecoveryPeriodInDays": 35,
1783
+ "ContributorInsightsSpecification.Mode": "ACCESSED_AND_THROTTLED_KEYS",
1784
+ "GlobalSecondaryIndexes.*.ContributorInsightsSpecification.Mode": "ACCESSED_AND_THROTTLED_KEYS",
1785
+ "SSESpecification.SSEType": "KMS"
1786
+ },
1787
+ "AWS::DynamoDB::GlobalTable": {
1788
+ "SSESpecification.SSEType": "KMS",
1789
+ "Replicas.*.ContributorInsightsSpecification.Mode": "ACCESSED_AND_THROTTLED_KEYS",
1790
+ "Replicas.*.GlobalSecondaryIndexes.*.ContributorInsightsSpecification.Mode": "ACCESSED_AND_THROTTLED_KEYS"
1791
+ },
1782
1792
  "AWS::ECS::TaskDefinition": { "ContainerDefinitions.*.Cpu": 0 },
1783
1793
  "AWS::Glue::Database": { "DatabaseInput.CreateTableDefaultPermissions": [{
1784
1794
  Permissions: ["ALL"],
@@ -1999,7 +2009,9 @@ const GENERATED_NESTED_PATHS = {
1999
2009
  "AWS::ECR::Repository": new Set(["LifecyclePolicy.RegistryId"]),
2000
2010
  "AWS::Lambda::Function": new Set(["LoggingConfig.LogGroup"]),
2001
2011
  "AWS::OpenSearchService::Domain": new Set(["EncryptionAtRestOptions.KmsKeyId"]),
2002
- "AWS::ApiGateway::Stage": new Set(["CanarySetting.DeploymentId"])
2012
+ "AWS::ApiGateway::Stage": new Set(["CanarySetting.DeploymentId"]),
2013
+ "AWS::DynamoDB::Table": new Set(["SSESpecification.KMSMasterKeyId"]),
2014
+ "AWS::DynamoDB::GlobalTable": new Set(["Replicas.*.SSESpecification.KMSMasterKeyId"])
2003
2015
  };
2004
2016
  const EB_OPTION_DEFAULTS = {
2005
2017
  "aws:autoscaling:asg|Availability Zones": "Any",
@@ -3634,6 +3646,17 @@ const CC_ALT_REPRESENTATION = {
3634
3646
  },
3635
3647
  "AWS::ElasticLoadBalancingV2::LoadBalancer": { SubnetMappings: "Subnets" }
3636
3648
  };
3649
+ const SHAPE_ECHO_TWIN = { "AWS::KinesisFirehose::DeliveryStream": { ExtendedS3DestinationConfiguration: "S3DestinationConfiguration" } };
3650
+ function twinOverlapEchoes(source, twin) {
3651
+ for (const [k, tv] of Object.entries(twin)) {
3652
+ if (!(k in source)) continue;
3653
+ const sv = source[k];
3654
+ if (isNestedObject(sv) && isNestedObject(tv)) {
3655
+ if (!twinOverlapEchoes(sv, tv)) return false;
3656
+ } else if (!deepEqual(sv, tv)) return false;
3657
+ }
3658
+ return true;
3659
+ }
3637
3660
  const IAM_ATTACHMENT_SUBSET = { "AWS::IAM::ManagedPolicy": new Set([
3638
3661
  "Roles",
3639
3662
  "Users",
@@ -3899,6 +3922,8 @@ function classifyResource(resource, liveRaw, schema, opts = {}) {
3899
3922
  path: k,
3900
3923
  note: "write-only — cannot be read back"
3901
3924
  });
3925
+ const twinSources = {};
3926
+ for (const src of Object.values(SHAPE_ECHO_TWIN[resourceType] ?? {})) if (isNestedObject(declared[src])) twinSources[src] = declared[src];
3902
3927
  deepStripPaths(declared, schema.writeOnlyPaths);
3903
3928
  const sibling = resource.siblingPolicyNames;
3904
3929
  if (sibling !== void 0 && sibling !== "unresolved" && Array.isArray(live.Policies)) {
@@ -4427,6 +4452,12 @@ function classifyResource(resource, liveRaw, schema, opts = {}) {
4427
4452
  });
4428
4453
  continue;
4429
4454
  }
4455
+ const twinSourceKey = SHAPE_ECHO_TWIN[resourceType]?.[k];
4456
+ const twinSource = twinSourceKey !== void 0 ? twinSources[twinSourceKey] ?? declared[twinSourceKey] : void 0;
4457
+ if (isNestedObject(v) && isNestedObject(twinSource) && twinOverlapEchoes(twinSource, v)) {
4458
+ collectNestedUndeclared(twinSource, v, k, emitNested, NESTED_ARRAY_IDENTITY[resourceType]);
4459
+ continue;
4460
+ }
4430
4461
  findings.push({
4431
4462
  tier: "undeclared",
4432
4463
  logicalId,
@@ -7835,6 +7866,11 @@ const CC_IDENTIFIER_ADAPTERS = {
7835
7866
  const rtb = declared.TransitGatewayRouteTableId;
7836
7867
  const att = declared.TransitGatewayAttachmentId;
7837
7868
  return typeof rtb === "string" && rtb.length > 0 && typeof att === "string" && att.length > 0 ? `${rtb}|${att}` : void 0;
7869
+ },
7870
+ "AWS::EC2::VPCCidrBlock": (pid, declared) => {
7871
+ if (pid.includes("|")) return pid;
7872
+ const vpcId = declared.VpcId;
7873
+ return typeof vpcId === "string" && vpcId.length > 0 ? `${pid}|${vpcId}` : void 0;
7838
7874
  }
7839
7875
  };
7840
7876
  function scalingPolicyComposite(pid, declared) {
@@ -10459,8 +10495,10 @@ const REVERT_SET_DEFAULT_PATHS = new Set([
10459
10495
  "AWS::SNS::Subscription\0FilterPolicyScope",
10460
10496
  "AWS::InternetMonitor::Monitor\0Status",
10461
10497
  "AWS::RolesAnywhere::Profile\0DurationSeconds",
10462
- "AWS::RolesAnywhere::Profile\0AttributeMappings"
10498
+ "AWS::RolesAnywhere::Profile\0AttributeMappings",
10499
+ "AWS::EC2::Subnet\0EnableDns64"
10463
10500
  ]);
10501
+ const REVERT_SET_DEFAULT_VALUES = { "AWS::EC2::Subnet\0EnableDns64": false };
10464
10502
  /**
10465
10503
  * A nested undeclared value (a live sub-key inside a declared object, R96/R98) — a dotted
10466
10504
  * path (`Conf.Destination`) or an identity-keyed array element (`Prop[<id>].sub`). Pure +
@@ -10726,8 +10764,9 @@ function revertOp(f, recorded) {
10726
10764
  prior: f.actual,
10727
10765
  human: `${f.path} -> baseline value`
10728
10766
  };
10729
- const knownDefault = KNOWN_DEFAULTS[f.resourceType]?.[f.path];
10730
- if (knownDefault !== void 0 && REVERT_SET_DEFAULT_PATHS.has(`${f.resourceType}\0${f.path}`)) return {
10767
+ const setDefaultKey = `${f.resourceType}\0${f.path}`;
10768
+ const knownDefault = KNOWN_DEFAULTS[f.resourceType]?.[f.path] ?? REVERT_SET_DEFAULT_VALUES[setDefaultKey];
10769
+ if (knownDefault !== void 0 && REVERT_SET_DEFAULT_PATHS.has(setDefaultKey)) return {
10731
10770
  op: "add",
10732
10771
  path: pointer,
10733
10772
  value: knownDefault,
@@ -10819,7 +10858,8 @@ const CC_UPDATE_REJECTED_EMPTY_PATHS = {
10819
10858
  "/Distributions/*/AmiDistributionConfiguration/TargetAccountIds",
10820
10859
  "/Distributions/*/FastLaunchConfigurations",
10821
10860
  "/Distributions/*/LaunchTemplateConfigurations"
10822
- ]
10861
+ ],
10862
+ "AWS::Lambda::EventInvokeConfig": ["/DestinationConfig/OnSuccess", "/DestinationConfig/OnFailure"]
10823
10863
  };
10824
10864
  function expandPointer(model, pointer) {
10825
10865
  let frontier = [{
@@ -10844,17 +10884,22 @@ function expandPointer(model, pointer) {
10844
10884
  value: node
10845
10885
  }));
10846
10886
  }
10887
+ function isEmptyHusk(value) {
10888
+ if (Array.isArray(value)) return value.length === 0;
10889
+ if (value !== null && typeof value === "object") return Object.keys(value).length === 0;
10890
+ return false;
10891
+ }
10847
10892
  function rejectedEmptyStripOps(resourceType, ops, liveRaw) {
10848
10893
  const pointers = CC_UPDATE_REJECTED_EMPTY_PATHS[resourceType];
10849
10894
  if (!pointers || !liveRaw || ops.length === 0) return [];
10850
10895
  const out = [];
10851
10896
  for (const pointer of pointers) for (const { pointer: concrete, value } of expandPointer(liveRaw, pointer)) {
10852
- if (!Array.isArray(value) || value.length > 0) continue;
10897
+ if (!isEmptyHusk(value)) continue;
10853
10898
  if (ops.some((o) => concrete === o.path || concrete.startsWith(`${o.path}/`))) continue;
10854
10899
  out.push({
10855
10900
  op: "remove",
10856
10901
  path: concrete,
10857
- human: `${concrete.slice(1).replaceAll("/", ".")} -> drop service-echoed empty array (service rejects [] on update)`
10902
+ human: `${concrete.slice(1).replaceAll("/", ".")} -> drop service-echoed empty husk (service rejects it on update)`
10858
10903
  });
10859
10904
  }
10860
10905
  return out;