cdk-real-drift 0.11.1 → 0.12.0

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/README.md CHANGED
@@ -792,6 +792,10 @@ covers them. **If you never run `revert`, cdkrd needs no write permissions at al
792
792
  `dms:DescribeEndpoints` + `dms:DescribeReplicationSubnetGroups` (read an
793
793
  `AWS::DMS::Endpoint` / `AWS::DMS::ReplicationSubnetGroup` — the classic DMS
794
794
  migration/CDC family, NON_PROVISIONABLE with no Cloud Control handlers),
795
+ `lakeformation:DescribeResource` (reads an `AWS::LakeFormation::Resource` — a
796
+ registered S3 data location whose Cloud Control `GetResource` returns
797
+ `UnsupportedActionException`; the physical id IS the location `ResourceArn`, and
798
+ the reader projects `RoleArn` / `WithFederation` / `HybridAccessEnabled`),
795
799
  `mediaconvert:GetQueue` + `mediaconvert:GetJobTemplate` (read an
796
800
  `AWS::MediaConvert::Queue` / `AWS::MediaConvert::JobTemplate` — a video-pipeline
797
801
  staple, NON_PROVISIONABLE with no Cloud Control handlers; the physical id IS the
package/dist/cli.js CHANGED
@@ -8,6 +8,7 @@ import { CloudControlClient, DeleteResourceCommand, GetResourceCommand, GetResou
8
8
  import { homedir } from "node:os";
9
9
  import { BaseCredentials, CdkAppMultiContext, NonInteractiveIoHost, StackSelectionStrategy, Toolkit } from "@aws-cdk/toolkit-lib";
10
10
  import { CloudFormationClient, DescribeStackResourcesCommand, DescribeStacksCommand, DescribeTypeCommand, GetTemplateCommand, ListExportsCommand, ListStackResourcesCommand } from "@aws-sdk/client-cloudformation";
11
+ import { DescribeAddressesCommand, DescribeClientVpnAuthorizationRulesCommand, DescribeClientVpnEndpointsCommand, DescribeClientVpnTargetNetworksCommand, DescribeLaunchTemplateVersionsCommand, DescribeNetworkAclsCommand, DescribeRouteTablesCommand, DescribeSecurityGroupsCommand, DescribeSubnetsCommand, DescribeVpcEndpointsCommand, EC2Client, ModifyClientVpnEndpointCommand } from "@aws-sdk/client-ec2";
11
12
  import { DescribeDBClustersCommand, DescribeDBInstancesCommand, DescribeOptionGroupOptionsCommand, RDSClient } from "@aws-sdk/client-rds";
12
13
  import { DescribeParametersCommand, GetParametersCommand, SSMClient } from "@aws-sdk/client-ssm";
13
14
  import jsonata from "jsonata";
@@ -19,7 +20,6 @@ import { AppSyncClient, ListApiKeysCommand, ListDataSourcesCommand, ListFunction
19
20
  import { ApiGatewayV2Client, DeleteAccessLogSettingsCommand, DeleteRouteSettingsCommand, GetAuthorizersCommand as GetAuthorizersCommand$1, GetIntegrationsCommand, GetRoutesCommand, GetStagesCommand as GetStagesCommand$1, UpdateStageCommand } from "@aws-sdk/client-apigatewayv2";
20
21
  import { CloudWatchLogsClient, DescribeMetricFiltersCommand, DescribeSubscriptionFiltersCommand, PutBearerTokenAuthenticationCommand, PutMetricFilterCommand } from "@aws-sdk/client-cloudwatch-logs";
21
22
  import { CognitoIdentityProviderClient, ListGroupsCommand, ListIdentityProvidersCommand, ListResourceServersCommand, ListUserPoolClientsCommand } from "@aws-sdk/client-cognito-identity-provider";
22
- import { DescribeAddressesCommand, DescribeClientVpnAuthorizationRulesCommand, DescribeClientVpnEndpointsCommand, DescribeClientVpnTargetNetworksCommand, DescribeLaunchTemplateVersionsCommand, DescribeNetworkAclsCommand, DescribeRouteTablesCommand, DescribeSubnetsCommand, DescribeVpcEndpointsCommand, EC2Client, ModifyClientVpnEndpointCommand } from "@aws-sdk/client-ec2";
23
23
  import { DescribeServicesCommand, ECSClient, ListServicesCommand, UpdateServiceCommand } from "@aws-sdk/client-ecs";
24
24
  import { DescribeMountTargetsCommand, EFSClient } from "@aws-sdk/client-efs";
25
25
  import { DescribeListenersCommand, DescribeRulesCommand, ElasticLoadBalancingV2Client, GetTrustStoreCaCertificatesBundleCommand, ModifyLoadBalancerAttributesCommand, ModifyTargetGroupAttributesCommand } from "@aws-sdk/client-elastic-load-balancing-v2";
@@ -42,6 +42,7 @@ import { DescribeParameterGroupsCommand as DescribeParameterGroupsCommand$1, Des
42
42
  import { CloudWatchClient, DescribeAnomalyDetectorsCommand, PutAnomalyDetectorCommand } from "@aws-sdk/client-cloudwatch";
43
43
  import { DLMClient, GetLifecyclePolicyCommand, UpdateLifecyclePolicyCommand } from "@aws-sdk/client-dlm";
44
44
  import { DatabaseMigrationServiceClient, DescribeEndpointsCommand, DescribeReplicationInstancesCommand, DescribeReplicationSubnetGroupsCommand, DescribeReplicationTasksCommand } from "@aws-sdk/client-database-migration-service";
45
+ import { DescribeResourceCommand, EntityNotFoundException, LakeFormationClient } from "@aws-sdk/client-lakeformation";
45
46
  import { GetJobTemplateCommand, GetQueueCommand, MediaConvertClient } from "@aws-sdk/client-mediaconvert";
46
47
  import { DescribeConfigurationCommand, DescribeConfigurationRevisionCommand, KafkaClient, UpdateConfigurationCommand } from "@aws-sdk/client-kafka";
47
48
  import { GetWorkgroupCommand, RedshiftServerlessClient } from "@aws-sdk/client-redshift-serverless";
@@ -1641,8 +1642,11 @@ function sanitizeAccountId(value, accountId) {
1641
1642
  function buildCorpusCase(resource, liveRaw, schema, opts, findings) {
1642
1643
  const sgSibling = resource.resourceType === "AWS::EC2::SecurityGroup" && resource.physicalId ? opts.siblingSgRules?.[resource.physicalId] : void 0;
1643
1644
  const bucketNotif = resource.physicalId && opts.bucketNotificationManaged?.has(resource.physicalId) ? [resource.physicalId] : void 0;
1645
+ const eipSiblingId = resource.physicalId && opts.siblingEipAssociations?.has(resource.physicalId) ? resource.physicalId : opts.siblingEipAssociations?.has(resource.logicalId) ? resource.logicalId : void 0;
1644
1646
  const echoModel = resource.physicalId && opts.clusterEchoModel?.[resource.physicalId] ? opts.clusterEchoModel[resource.physicalId] : void 0;
1645
1647
  const rdsOptCatalog = resource.physicalId && opts.rdsOptionSettingDefaults?.[resource.physicalId] ? opts.rdsOptionSettingDefaults[resource.physicalId] : void 0;
1648
+ const listenerArn = resource.resourceType === "AWS::GlobalAccelerator::EndpointGroup" ? resource.declared?.ListenerArn : void 0;
1649
+ const gaListenerPort = typeof listenerArn === "string" && opts.siblingListenerPorts?.[listenerArn] !== void 0 ? { [listenerArn]: opts.siblingListenerPorts[listenerArn] } : void 0;
1646
1650
  return sanitizeAccountId({
1647
1651
  corpusVersion: 1,
1648
1652
  resource: {
@@ -1674,8 +1678,10 @@ function buildCorpusCase(resource, liveRaw, schema, opts, findings) {
1674
1678
  oaiCanonicalIds: opts.oaiCanonicalIds,
1675
1679
  ...sgSibling && resource.physicalId ? { siblingSgRules: { [resource.physicalId]: sgSibling } } : {},
1676
1680
  ...bucketNotif ? { bucketNotificationManaged: bucketNotif } : {},
1681
+ ...eipSiblingId ? { siblingEipAssociations: [eipSiblingId] } : {},
1677
1682
  ...echoModel && resource.physicalId ? { clusterEchoModel: { [resource.physicalId]: echoModel } } : {},
1678
- ...rdsOptCatalog && resource.physicalId ? { rdsOptionSettingDefaults: { [resource.physicalId]: rdsOptCatalog } } : {}
1683
+ ...rdsOptCatalog && resource.physicalId ? { rdsOptionSettingDefaults: { [resource.physicalId]: rdsOptCatalog } } : {},
1684
+ ...gaListenerPort ? { siblingListenerPorts: gaListenerPort } : {}
1679
1685
  },
1680
1686
  expected: findings
1681
1687
  }, opts.accountId);
@@ -3037,7 +3043,6 @@ function ebOptionSettingTier(namespace, optionName, value, envType, siblingOptio
3037
3043
  return "undeclared";
3038
3044
  }
3039
3045
  const VALUE_INDEPENDENT_DEFAULT_TOPLEVEL_PATHS = {
3040
- "AWS::ElasticLoadBalancingV2::LoadBalancer": new Set(["SecurityGroups"]),
3041
3046
  "AWS::ApiGateway::ApiKey": new Set(["Value"]),
3042
3047
  "AWS::Backup::BackupVault": new Set(["EncryptionKeyArn"]),
3043
3048
  "AWS::Batch::JobQueue": new Set(["JobQueueType"]),
@@ -3111,15 +3116,11 @@ const VALUE_INDEPENDENT_DEFAULT_TOPLEVEL_PATHS = {
3111
3116
  "CpuOptions",
3112
3117
  "SubnetId"
3113
3118
  ]),
3114
- "AWS::EC2::NetworkInterface": new Set([
3115
- "PrivateIpAddress",
3116
- "PrivateIpAddresses",
3117
- "GroupSet"
3118
- ]),
3119
+ "AWS::EC2::NetworkInterface": new Set(["PrivateIpAddress", "PrivateIpAddresses"]),
3119
3120
  "AWS::EC2::Volume": new Set(["KmsKeyId", "AvailabilityZoneId"]),
3120
3121
  "AWS::EC2::NatGateway": new Set(["PrivateIpAddress", "VpcId"]),
3121
3122
  "AWS::EFS::MountTarget": new Set(["IpAddress"]),
3122
- "AWS::EC2::EIP": new Set(["NetworkBorderGroup", "NetworkInterfaceId"]),
3123
+ "AWS::EC2::EIP": new Set(["NetworkBorderGroup"]),
3123
3124
  "AWS::EFS::FileSystem": new Set(["KmsKeyId"]),
3124
3125
  "AWS::EC2::SecurityGroup": new Set(["VpcId"]),
3125
3126
  "AWS::GlobalAccelerator::Accelerator": new Set(["IpAddresses"]),
@@ -5093,6 +5094,23 @@ function guardDutyFeaturesAllAtDefault(features) {
5093
5094
  };
5094
5095
  return features.every(atDefault);
5095
5096
  }
5097
+ const DEFAULT_SG_LIST_PATHS = {
5098
+ "AWS::ElasticLoadBalancingV2::LoadBalancer": "SecurityGroups",
5099
+ "AWS::EC2::NetworkInterface": "GroupSet"
5100
+ };
5101
+ /** #889 fold decision for an UNDECLARED default-SG list (ALB SecurityGroups / ENI GroupSet).
5102
+ * Returns whether the value-independent fold should still apply for this live value:
5103
+ * - `true` → FOLD (atDefault): the live list is a single VPC-default SG id, OR the prefetch is
5104
+ * unavailable (fail OPEN — no ec2:DescribeSecurityGroups / lookup failed / empty).
5105
+ * - `false` → SURFACE (undeclared): the live list has 2+ elements (an out-of-band SG APPEND) or
5106
+ * a single NON-default SG (an out-of-band SWAP) — a real, security-relevant drift.
5107
+ * Pure; `defaultSgIds` is the resolved set of VPC-default SG ids (undefined/empty when unresolved).*/
5108
+ function shouldFoldDefaultSgList(resourceType, key, liveValue, defaultSgIds) {
5109
+ if (DEFAULT_SG_LIST_PATHS[resourceType] !== key) return false;
5110
+ if (!defaultSgIds || defaultSgIds.size === 0) return true;
5111
+ if (!Array.isArray(liveValue)) return true;
5112
+ return liveValue.length === 1 && typeof liveValue[0] === "string" && defaultSgIds.has(liveValue[0]);
5113
+ }
5096
5114
  const stripCognitoAttrPrefix = (id) => id.replace(/^(custom|dev):/, "");
5097
5115
  const IDENTITY_KEYED_SUBSET_ARRAYS = {
5098
5116
  "AWS::Cognito::UserPool": { Schema: {
@@ -5629,6 +5647,9 @@ function classifyResource(resource, liveRaw, schema, opts = {}) {
5629
5647
  const sibHooks = physicalId ? opts.siblingLifecycleHooks?.[physicalId] : void 0;
5630
5648
  if (sibHooks) subtractSiblingLifecycleHooks(live, sibHooks);
5631
5649
  }
5650
+ if (resourceType === "AWS::EC2::EIP" && "NetworkInterfaceId" in live) {
5651
+ if (physicalId !== void 0 && opts.siblingEipAssociations?.has(physicalId) || opts.siblingEipAssociations?.has(logicalId)) delete live.NetworkInterfaceId;
5652
+ }
5632
5653
  if (resourceType === "AWS::S3::Bucket" && physicalId && opts.bucketNotificationManaged?.has(physicalId) && !("NotificationConfiguration" in declared)) delete live.NotificationConfiguration;
5633
5654
  const echoSpec = CLUSTER_ECHO_CHILD[resourceType];
5634
5655
  const echoModel = echoSpec && physicalId ? opts.clusterEchoModel?.[physicalId] : void 0;
@@ -5781,6 +5802,14 @@ function classifyResource(resource, liveRaw, schema, opts = {}) {
5781
5802
  Id: `${attach}_${rtb}`
5782
5803
  };
5783
5804
  }
5805
+ if (resourceType === "AWS::GlobalAccelerator::EndpointGroup") {
5806
+ const listenerArn = declared["ListenerArn"];
5807
+ const port = typeof listenerArn === "string" ? opts.siblingListenerPorts?.[listenerArn] : void 0;
5808
+ if (typeof port === "number") knownDef = {
5809
+ ...knownDef,
5810
+ HealthCheckPort: port
5811
+ };
5812
+ }
5784
5813
  if (resourceType === "AWS::Lambda::EventSourceMapping") {
5785
5814
  const arn = declared["EventSourceArn"];
5786
5815
  const service = typeof arn === "string" ? arn.split(":")[2] : void 0;
@@ -6300,6 +6329,16 @@ function classifyResource(resource, liveRaw, schema, opts = {}) {
6300
6329
  });
6301
6330
  continue;
6302
6331
  }
6332
+ if (DEFAULT_SG_LIST_PATHS[resourceType] === k && !isTrivialEmpty(v)) {
6333
+ findings.push({
6334
+ tier: shouldFoldDefaultSgList(resourceType, k, v, opts.defaultSgIds) ? "atDefault" : "undeclared",
6335
+ logicalId,
6336
+ resourceType,
6337
+ path: k,
6338
+ actual: v
6339
+ });
6340
+ continue;
6341
+ }
6303
6342
  if (k in schema.defaults && matchesKnownDefault(v, schema.defaults[k]) || k in knownDef && matchesKnownDefault(v, knownDef[k]) || KNOWN_DEFAULT_ONE_OF[resourceType]?.[k]?.some((d) => matchesKnownDefault(v, d)) || VALUE_INDEPENDENT_DEFAULT_TOPLEVEL_PATHS[resourceType]?.has(k) && !isTrivialEmpty(v) && !(k in knownDef) || clbDefaultSslPoliciesAtDefault(resourceType, k, v)) {
6304
6343
  findings.push({
6305
6344
  tier: "atDefault",
@@ -9000,6 +9039,28 @@ const readDmsReplicationTask = async ({ physicalId, region }) => {
9000
9039
  if (str$1(t.TaskData)) model.TaskData = t.TaskData;
9001
9040
  return model;
9002
9041
  };
9042
+ const readLakeFormationResource = async ({ physicalId, region }) => {
9043
+ const arn = str$1(physicalId);
9044
+ if (!arn) return void 0;
9045
+ const c = new LakeFormationClient({
9046
+ region,
9047
+ ...READ_RETRY
9048
+ });
9049
+ let info;
9050
+ try {
9051
+ info = (await c.send(new DescribeResourceCommand({ ResourceArn: arn }))).ResourceInfo;
9052
+ } catch (e) {
9053
+ if (e instanceof EntityNotFoundException) throw new ResourceGoneError(`LakeFormation Resource ${arn} absent`);
9054
+ throw e;
9055
+ }
9056
+ if (!info) throw new ResourceGoneError(`LakeFormation Resource ${arn} absent`);
9057
+ const model = {};
9058
+ if (str$1(info.ResourceArn)) model.ResourceArn = info.ResourceArn;
9059
+ if (str$1(info.RoleArn)) model.RoleArn = info.RoleArn;
9060
+ if (typeof info.WithFederation === "boolean") model.WithFederation = info.WithFederation;
9061
+ if (typeof info.HybridAccessEnabled === "boolean") model.HybridAccessEnabled = info.HybridAccessEnabled;
9062
+ return model;
9063
+ };
9003
9064
  const readMediaConvertQueue = async ({ physicalId, region }) => {
9004
9065
  const name = str$1(physicalId);
9005
9066
  if (!name) return void 0;
@@ -10004,6 +10065,7 @@ const SDK_OVERRIDES = {
10004
10065
  "AWS::DMS::ReplicationSubnetGroup": readDmsReplicationSubnetGroup,
10005
10066
  "AWS::DMS::ReplicationInstance": readDmsReplicationInstance,
10006
10067
  "AWS::DMS::ReplicationTask": readDmsReplicationTask,
10068
+ "AWS::LakeFormation::Resource": readLakeFormationResource,
10007
10069
  "AWS::MediaConvert::Queue": readMediaConvertQueue,
10008
10070
  "AWS::MediaConvert::JobTemplate": readMediaConvertJobTemplate,
10009
10071
  "AWS::Route53::RecordSet": readRoute53RecordSet,
@@ -10930,6 +10992,36 @@ function liveModelMap(reads) {
10930
10992
  for (const [logicalId, read] of reads) if (read.live) out.set(logicalId, read.live);
10931
10993
  return out;
10932
10994
  }
10995
+ const DEFAULT_SG_LIST_TYPES = new Set(["AWS::ElasticLoadBalancingV2::LoadBalancer", "AWS::EC2::NetworkInterface"]);
10996
+ const defaultSgIdsCache = /* @__PURE__ */ new Map();
10997
+ async function fetchDefaultSgIds(region) {
10998
+ const cached = defaultSgIdsCache.get(region);
10999
+ if (cached) return cached;
11000
+ const ids = /* @__PURE__ */ new Set();
11001
+ try {
11002
+ const c = new EC2Client({
11003
+ region,
11004
+ ...READ_RETRY
11005
+ });
11006
+ let token;
11007
+ do {
11008
+ const r = await c.send(new DescribeSecurityGroupsCommand({
11009
+ Filters: [{
11010
+ Name: "group-name",
11011
+ Values: ["default"]
11012
+ }],
11013
+ NextToken: token,
11014
+ MaxResults: 1e3
11015
+ }));
11016
+ for (const g of r.SecurityGroups ?? []) if (g.GroupId) ids.add(g.GroupId);
11017
+ token = r.NextToken;
11018
+ } while (token);
11019
+ } catch {
11020
+ return ids;
11021
+ }
11022
+ defaultSgIdsCache.set(region, ids);
11023
+ return ids;
11024
+ }
10933
11025
  const kmsDeniedWarned = /* @__PURE__ */ new Set();
10934
11026
  const kmsTransientWarned = /* @__PURE__ */ new Set();
10935
11027
  const POOL_SIZE = 6;
@@ -11173,6 +11265,18 @@ function buildSiblingLifecycleHooks(desired) {
11173
11265
  }
11174
11266
  return map;
11175
11267
  }
11268
+ const GA_LISTENER_TYPE = "AWS::GlobalAccelerator::Listener";
11269
+ function buildSiblingListenerPorts(desired) {
11270
+ const map = {};
11271
+ for (const r of desired.resources) {
11272
+ if (r.resourceType !== GA_LISTENER_TYPE || !r.physicalId) continue;
11273
+ const ranges = r.declared?.PortRanges;
11274
+ const first = Array.isArray(ranges) ? ranges[0] : void 0;
11275
+ const from = first && typeof first === "object" ? first.FromPort : void 0;
11276
+ if (typeof from === "number") map[r.physicalId] = from;
11277
+ }
11278
+ return map;
11279
+ }
11176
11280
  function resolvePrincipalKey(ref, byLogicalId) {
11177
11281
  if (typeof ref === "string" && ref) return ref;
11178
11282
  if (ref && typeof ref === "object" && "Ref" in ref) {
@@ -11180,6 +11284,44 @@ function resolvePrincipalKey(ref, byLogicalId) {
11180
11284
  if (typeof logicalId === "string") return byLogicalId.get(logicalId);
11181
11285
  }
11182
11286
  }
11287
+ const EIP_ASSOCIATION_TYPE = "AWS::EC2::EIPAssociation";
11288
+ const NAT_GATEWAY_TYPE = "AWS::EC2::NatGateway";
11289
+ function buildSiblingEipAssociations(desired) {
11290
+ const eipIdentities = /* @__PURE__ */ new Map();
11291
+ for (const r of desired.resources) {
11292
+ if (r.resourceType !== "AWS::EC2::EIP") continue;
11293
+ const ids = [r.logicalId];
11294
+ if (r.physicalId) ids.push(r.physicalId);
11295
+ eipIdentities.set(r.logicalId, ids);
11296
+ }
11297
+ const associated = /* @__PURE__ */ new Set();
11298
+ const markEip = (ref) => {
11299
+ let eipLogicalId;
11300
+ if (ref && typeof ref === "object") {
11301
+ if ("Ref" in ref && typeof ref.Ref === "string") eipLogicalId = ref.Ref;
11302
+ else if ("Fn::GetAtt" in ref) {
11303
+ const g = ref["Fn::GetAtt"];
11304
+ if (Array.isArray(g) && typeof g[0] === "string") eipLogicalId = g[0];
11305
+ }
11306
+ }
11307
+ if (eipLogicalId !== void 0) {
11308
+ const ids = eipIdentities.get(eipLogicalId);
11309
+ if (ids) for (const id of ids) associated.add(id);
11310
+ return;
11311
+ }
11312
+ if (typeof ref === "string" && ref) associated.add(ref);
11313
+ };
11314
+ for (const r of desired.resources) {
11315
+ const decl = r.declared;
11316
+ if (!decl || typeof decl !== "object") continue;
11317
+ const d = decl;
11318
+ if (r.resourceType === EIP_ASSOCIATION_TYPE) {
11319
+ markEip(d.AllocationId);
11320
+ markEip(d.EIP);
11321
+ } else if (r.resourceType === NAT_GATEWAY_TYPE) markEip(d.AllocationId);
11322
+ }
11323
+ return associated;
11324
+ }
11183
11325
  function buildClusterEchoModels(desired) {
11184
11326
  const parentTypes = new Set(Object.values(CLUSTER_ECHO_CHILD).map((s) => s.parentType));
11185
11327
  const clusterByPhys = {};
@@ -11376,16 +11518,21 @@ async function gatherFindings(stackName, region, templateOverride, recoveryTempl
11376
11518
  if (decision.stampTransient) kmsTransientWarned.add(region);
11377
11519
  if (decision.warning) console.error(decision.warning);
11378
11520
  }
11521
+ let defaultSgIds = /* @__PURE__ */ new Set();
11522
+ if (desired.resources.some((r) => DEFAULT_SG_LIST_TYPES.has(r.resourceType))) defaultSgIds = await fetchDefaultSgIds(region);
11379
11523
  const classifyOpts = {
11380
11524
  accountId: desired.accountId,
11381
11525
  region,
11382
11526
  kmsAliasTargets,
11527
+ defaultSgIds,
11383
11528
  oaiCanonicalIds,
11384
11529
  siblingSgRules: buildSiblingSgRules(desired),
11385
11530
  siblingEventBusPolicies: buildSiblingEventBusPolicies(desired),
11386
11531
  siblingManagedPolicyAttachments: buildSiblingManagedPolicyAttachments(desired),
11387
11532
  siblingUserGroups: buildSiblingUserGroups(desired),
11388
11533
  siblingLifecycleHooks: buildSiblingLifecycleHooks(desired),
11534
+ siblingListenerPorts: buildSiblingListenerPorts(desired),
11535
+ siblingEipAssociations: buildSiblingEipAssociations(desired),
11389
11536
  bucketNotificationManaged: buildBucketNotificationManaged(desired),
11390
11537
  clusterEchoModel: buildClusterEchoModels(desired),
11391
11538
  rdsOptionSettingDefaults: await buildRdsOptionSettingDefaults(desired, region)
@@ -11439,16 +11586,21 @@ async function regatherTouched(gathered, touched, region) {
11439
11586
  for (const r of targets) if (r.declaredRaw) r.declared = resolveProperties(r.declaredRaw, desired.ctx);
11440
11587
  const kmsAliasTargets = targets.some((r) => usesManagedKmsAlias(r.declared) || typeNeedsManagedKeyResolution(r.resourceType)) ? (await fetchManagedAliasTargets(region)).targets : {};
11441
11588
  const oaiCanonicalIds = buildOaiCanonicalIds(desired);
11589
+ let defaultSgIds = /* @__PURE__ */ new Set();
11590
+ if (targets.some((r) => DEFAULT_SG_LIST_TYPES.has(r.resourceType))) defaultSgIds = await fetchDefaultSgIds(region);
11442
11591
  const classifyOpts = {
11443
11592
  accountId: desired.accountId,
11444
11593
  region,
11445
11594
  kmsAliasTargets,
11595
+ defaultSgIds,
11446
11596
  oaiCanonicalIds,
11447
11597
  siblingSgRules: buildSiblingSgRules(desired),
11448
11598
  siblingEventBusPolicies: buildSiblingEventBusPolicies(desired),
11449
11599
  siblingManagedPolicyAttachments: buildSiblingManagedPolicyAttachments(desired),
11450
11600
  siblingUserGroups: buildSiblingUserGroups(desired),
11451
11601
  siblingLifecycleHooks: buildSiblingLifecycleHooks(desired),
11602
+ siblingListenerPorts: buildSiblingListenerPorts(desired),
11603
+ siblingEipAssociations: buildSiblingEipAssociations(desired),
11452
11604
  bucketNotificationManaged: buildBucketNotificationManaged(desired),
11453
11605
  clusterEchoModel: buildClusterEchoModels(desired),
11454
11606
  rdsOptionSettingDefaults: await buildRdsOptionSettingDefaults(desired, region)
@@ -12411,35 +12563,10 @@ async function bulkMultiselect(message, options) {
12411
12563
  function unescape(seg) {
12412
12564
  return seg.replace(/~1/g, "/").replace(/~0/g, "~");
12413
12565
  }
12414
- function pointerSegs(path) {
12415
- return path.split("/").slice(1).map(unescape);
12416
- }
12417
- var StaleRevertModelError = class extends Error {
12418
- pointerPath;
12419
- constructor(pointerPath) {
12420
- super(`revert aborted: the live value at ${pointerPath} changed since drift was detected (an element in the same array was added or removed) — re-run \`check\` and revert again`);
12421
- this.name = "StaleRevertModelError";
12422
- this.pointerPath = pointerPath;
12423
- }
12424
- };
12425
- function assertPriorUnchanged(model, ops) {
12426
- for (const op of ops) {
12427
- if (op.prior === void 0) continue;
12428
- if (!deepEqual(getAt(model, pointerSegs(op.path)), op.prior)) throw new StaleRevertModelError(op.path);
12429
- }
12430
- }
12431
- function getAt(root, segs) {
12432
- let node = root;
12433
- for (const seg of segs) {
12434
- if (node === null || typeof node !== "object") return void 0;
12435
- node = node[seg];
12436
- }
12437
- return node;
12438
- }
12439
12566
  function applyOps(model, ops) {
12440
12567
  const out = structuredClone(model);
12441
12568
  for (const op of ops) {
12442
- const segs = pointerSegs(op.path);
12569
+ const segs = op.path.split("/").slice(1).map(unescape);
12443
12570
  if (op.op === "add") setAt(out, segs, op.value);
12444
12571
  else removeAt(out, segs);
12445
12572
  }
@@ -12477,12 +12604,10 @@ const assertOpsConsumed = (resourceType, ops, handled) => {
12477
12604
  async function desiredModel(type, ctx, ops) {
12478
12605
  const reader = SDK_OVERRIDES[type];
12479
12606
  const current = (reader && await reader(ctx)) ?? {};
12480
- const aligned = current.PolicyDocument === void 0 ? current : {
12607
+ return applyOps(current.PolicyDocument === void 0 ? current : {
12481
12608
  ...current,
12482
12609
  PolicyDocument: canonicalizeForCompare(current.PolicyDocument)
12483
- };
12484
- assertPriorUnchanged(aligned, ops);
12485
- return applyOps(aligned, ops);
12610
+ }, ops);
12486
12611
  }
12487
12612
  const policyJson = (m) => m.PolicyDocument === void 0 ? void 0 : JSON.stringify(m.PolicyDocument);
12488
12613
  const writeS3BucketPolicy = async (ctx, ops) => {
@@ -12842,9 +12967,7 @@ const writeWafv2WebAcl = async (ctx, ops) => {
12842
12967
  Scope: scope
12843
12968
  }));
12844
12969
  if (!cur.WebACL || !cur.LockToken) throw new Error("could not read current WebACL for revert");
12845
- const alignedWebAcl = canonicalizeForCompare(cur.WebACL);
12846
- assertPriorUnchanged(alignedWebAcl, ops);
12847
- const m = applyOps(alignedWebAcl, ops);
12970
+ const m = applyOps(canonicalizeForCompare(cur.WebACL), ops);
12848
12971
  const desc = m.Description;
12849
12972
  await c.send(new UpdateWebACLCommand({
12850
12973
  Name: name,