cdk-real-drift 0.11.2 → 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 +4 -0
- package/dist/cli.js +139 -41
- package/dist/cli.js.map +1 -1
- package/package.json +2 -1
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,6 +1642,7 @@ 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;
|
|
1646
1648
|
const listenerArn = resource.resourceType === "AWS::GlobalAccelerator::EndpointGroup" ? resource.declared?.ListenerArn : void 0;
|
|
@@ -1676,6 +1678,7 @@ function buildCorpusCase(resource, liveRaw, schema, opts, findings) {
|
|
|
1676
1678
|
oaiCanonicalIds: opts.oaiCanonicalIds,
|
|
1677
1679
|
...sgSibling && resource.physicalId ? { siblingSgRules: { [resource.physicalId]: sgSibling } } : {},
|
|
1678
1680
|
...bucketNotif ? { bucketNotificationManaged: bucketNotif } : {},
|
|
1681
|
+
...eipSiblingId ? { siblingEipAssociations: [eipSiblingId] } : {},
|
|
1679
1682
|
...echoModel && resource.physicalId ? { clusterEchoModel: { [resource.physicalId]: echoModel } } : {},
|
|
1680
1683
|
...rdsOptCatalog && resource.physicalId ? { rdsOptionSettingDefaults: { [resource.physicalId]: rdsOptCatalog } } : {},
|
|
1681
1684
|
...gaListenerPort ? { siblingListenerPorts: gaListenerPort } : {}
|
|
@@ -3040,7 +3043,6 @@ function ebOptionSettingTier(namespace, optionName, value, envType, siblingOptio
|
|
|
3040
3043
|
return "undeclared";
|
|
3041
3044
|
}
|
|
3042
3045
|
const VALUE_INDEPENDENT_DEFAULT_TOPLEVEL_PATHS = {
|
|
3043
|
-
"AWS::ElasticLoadBalancingV2::LoadBalancer": new Set(["SecurityGroups"]),
|
|
3044
3046
|
"AWS::ApiGateway::ApiKey": new Set(["Value"]),
|
|
3045
3047
|
"AWS::Backup::BackupVault": new Set(["EncryptionKeyArn"]),
|
|
3046
3048
|
"AWS::Batch::JobQueue": new Set(["JobQueueType"]),
|
|
@@ -3114,15 +3116,11 @@ const VALUE_INDEPENDENT_DEFAULT_TOPLEVEL_PATHS = {
|
|
|
3114
3116
|
"CpuOptions",
|
|
3115
3117
|
"SubnetId"
|
|
3116
3118
|
]),
|
|
3117
|
-
"AWS::EC2::NetworkInterface": new Set([
|
|
3118
|
-
"PrivateIpAddress",
|
|
3119
|
-
"PrivateIpAddresses",
|
|
3120
|
-
"GroupSet"
|
|
3121
|
-
]),
|
|
3119
|
+
"AWS::EC2::NetworkInterface": new Set(["PrivateIpAddress", "PrivateIpAddresses"]),
|
|
3122
3120
|
"AWS::EC2::Volume": new Set(["KmsKeyId", "AvailabilityZoneId"]),
|
|
3123
3121
|
"AWS::EC2::NatGateway": new Set(["PrivateIpAddress", "VpcId"]),
|
|
3124
3122
|
"AWS::EFS::MountTarget": new Set(["IpAddress"]),
|
|
3125
|
-
"AWS::EC2::EIP": new Set(["NetworkBorderGroup"
|
|
3123
|
+
"AWS::EC2::EIP": new Set(["NetworkBorderGroup"]),
|
|
3126
3124
|
"AWS::EFS::FileSystem": new Set(["KmsKeyId"]),
|
|
3127
3125
|
"AWS::EC2::SecurityGroup": new Set(["VpcId"]),
|
|
3128
3126
|
"AWS::GlobalAccelerator::Accelerator": new Set(["IpAddresses"]),
|
|
@@ -5096,6 +5094,23 @@ function guardDutyFeaturesAllAtDefault(features) {
|
|
|
5096
5094
|
};
|
|
5097
5095
|
return features.every(atDefault);
|
|
5098
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
|
+
}
|
|
5099
5114
|
const stripCognitoAttrPrefix = (id) => id.replace(/^(custom|dev):/, "");
|
|
5100
5115
|
const IDENTITY_KEYED_SUBSET_ARRAYS = {
|
|
5101
5116
|
"AWS::Cognito::UserPool": { Schema: {
|
|
@@ -5632,6 +5647,9 @@ function classifyResource(resource, liveRaw, schema, opts = {}) {
|
|
|
5632
5647
|
const sibHooks = physicalId ? opts.siblingLifecycleHooks?.[physicalId] : void 0;
|
|
5633
5648
|
if (sibHooks) subtractSiblingLifecycleHooks(live, sibHooks);
|
|
5634
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
|
+
}
|
|
5635
5653
|
if (resourceType === "AWS::S3::Bucket" && physicalId && opts.bucketNotificationManaged?.has(physicalId) && !("NotificationConfiguration" in declared)) delete live.NotificationConfiguration;
|
|
5636
5654
|
const echoSpec = CLUSTER_ECHO_CHILD[resourceType];
|
|
5637
5655
|
const echoModel = echoSpec && physicalId ? opts.clusterEchoModel?.[physicalId] : void 0;
|
|
@@ -6311,6 +6329,16 @@ function classifyResource(resource, liveRaw, schema, opts = {}) {
|
|
|
6311
6329
|
});
|
|
6312
6330
|
continue;
|
|
6313
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
|
+
}
|
|
6314
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)) {
|
|
6315
6343
|
findings.push({
|
|
6316
6344
|
tier: "atDefault",
|
|
@@ -9011,6 +9039,28 @@ const readDmsReplicationTask = async ({ physicalId, region }) => {
|
|
|
9011
9039
|
if (str$1(t.TaskData)) model.TaskData = t.TaskData;
|
|
9012
9040
|
return model;
|
|
9013
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
|
+
};
|
|
9014
9064
|
const readMediaConvertQueue = async ({ physicalId, region }) => {
|
|
9015
9065
|
const name = str$1(physicalId);
|
|
9016
9066
|
if (!name) return void 0;
|
|
@@ -10015,6 +10065,7 @@ const SDK_OVERRIDES = {
|
|
|
10015
10065
|
"AWS::DMS::ReplicationSubnetGroup": readDmsReplicationSubnetGroup,
|
|
10016
10066
|
"AWS::DMS::ReplicationInstance": readDmsReplicationInstance,
|
|
10017
10067
|
"AWS::DMS::ReplicationTask": readDmsReplicationTask,
|
|
10068
|
+
"AWS::LakeFormation::Resource": readLakeFormationResource,
|
|
10018
10069
|
"AWS::MediaConvert::Queue": readMediaConvertQueue,
|
|
10019
10070
|
"AWS::MediaConvert::JobTemplate": readMediaConvertJobTemplate,
|
|
10020
10071
|
"AWS::Route53::RecordSet": readRoute53RecordSet,
|
|
@@ -10941,6 +10992,36 @@ function liveModelMap(reads) {
|
|
|
10941
10992
|
for (const [logicalId, read] of reads) if (read.live) out.set(logicalId, read.live);
|
|
10942
10993
|
return out;
|
|
10943
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
|
+
}
|
|
10944
11025
|
const kmsDeniedWarned = /* @__PURE__ */ new Set();
|
|
10945
11026
|
const kmsTransientWarned = /* @__PURE__ */ new Set();
|
|
10946
11027
|
const POOL_SIZE = 6;
|
|
@@ -11203,6 +11284,44 @@ function resolvePrincipalKey(ref, byLogicalId) {
|
|
|
11203
11284
|
if (typeof logicalId === "string") return byLogicalId.get(logicalId);
|
|
11204
11285
|
}
|
|
11205
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
|
+
}
|
|
11206
11325
|
function buildClusterEchoModels(desired) {
|
|
11207
11326
|
const parentTypes = new Set(Object.values(CLUSTER_ECHO_CHILD).map((s) => s.parentType));
|
|
11208
11327
|
const clusterByPhys = {};
|
|
@@ -11399,10 +11518,13 @@ async function gatherFindings(stackName, region, templateOverride, recoveryTempl
|
|
|
11399
11518
|
if (decision.stampTransient) kmsTransientWarned.add(region);
|
|
11400
11519
|
if (decision.warning) console.error(decision.warning);
|
|
11401
11520
|
}
|
|
11521
|
+
let defaultSgIds = /* @__PURE__ */ new Set();
|
|
11522
|
+
if (desired.resources.some((r) => DEFAULT_SG_LIST_TYPES.has(r.resourceType))) defaultSgIds = await fetchDefaultSgIds(region);
|
|
11402
11523
|
const classifyOpts = {
|
|
11403
11524
|
accountId: desired.accountId,
|
|
11404
11525
|
region,
|
|
11405
11526
|
kmsAliasTargets,
|
|
11527
|
+
defaultSgIds,
|
|
11406
11528
|
oaiCanonicalIds,
|
|
11407
11529
|
siblingSgRules: buildSiblingSgRules(desired),
|
|
11408
11530
|
siblingEventBusPolicies: buildSiblingEventBusPolicies(desired),
|
|
@@ -11410,6 +11532,7 @@ async function gatherFindings(stackName, region, templateOverride, recoveryTempl
|
|
|
11410
11532
|
siblingUserGroups: buildSiblingUserGroups(desired),
|
|
11411
11533
|
siblingLifecycleHooks: buildSiblingLifecycleHooks(desired),
|
|
11412
11534
|
siblingListenerPorts: buildSiblingListenerPorts(desired),
|
|
11535
|
+
siblingEipAssociations: buildSiblingEipAssociations(desired),
|
|
11413
11536
|
bucketNotificationManaged: buildBucketNotificationManaged(desired),
|
|
11414
11537
|
clusterEchoModel: buildClusterEchoModels(desired),
|
|
11415
11538
|
rdsOptionSettingDefaults: await buildRdsOptionSettingDefaults(desired, region)
|
|
@@ -11463,10 +11586,13 @@ async function regatherTouched(gathered, touched, region) {
|
|
|
11463
11586
|
for (const r of targets) if (r.declaredRaw) r.declared = resolveProperties(r.declaredRaw, desired.ctx);
|
|
11464
11587
|
const kmsAliasTargets = targets.some((r) => usesManagedKmsAlias(r.declared) || typeNeedsManagedKeyResolution(r.resourceType)) ? (await fetchManagedAliasTargets(region)).targets : {};
|
|
11465
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);
|
|
11466
11591
|
const classifyOpts = {
|
|
11467
11592
|
accountId: desired.accountId,
|
|
11468
11593
|
region,
|
|
11469
11594
|
kmsAliasTargets,
|
|
11595
|
+
defaultSgIds,
|
|
11470
11596
|
oaiCanonicalIds,
|
|
11471
11597
|
siblingSgRules: buildSiblingSgRules(desired),
|
|
11472
11598
|
siblingEventBusPolicies: buildSiblingEventBusPolicies(desired),
|
|
@@ -11474,6 +11600,7 @@ async function regatherTouched(gathered, touched, region) {
|
|
|
11474
11600
|
siblingUserGroups: buildSiblingUserGroups(desired),
|
|
11475
11601
|
siblingLifecycleHooks: buildSiblingLifecycleHooks(desired),
|
|
11476
11602
|
siblingListenerPorts: buildSiblingListenerPorts(desired),
|
|
11603
|
+
siblingEipAssociations: buildSiblingEipAssociations(desired),
|
|
11477
11604
|
bucketNotificationManaged: buildBucketNotificationManaged(desired),
|
|
11478
11605
|
clusterEchoModel: buildClusterEchoModels(desired),
|
|
11479
11606
|
rdsOptionSettingDefaults: await buildRdsOptionSettingDefaults(desired, region)
|
|
@@ -12436,35 +12563,10 @@ async function bulkMultiselect(message, options) {
|
|
|
12436
12563
|
function unescape(seg) {
|
|
12437
12564
|
return seg.replace(/~1/g, "/").replace(/~0/g, "~");
|
|
12438
12565
|
}
|
|
12439
|
-
function pointerSegs(path) {
|
|
12440
|
-
return path.split("/").slice(1).map(unescape);
|
|
12441
|
-
}
|
|
12442
|
-
var StaleRevertModelError = class extends Error {
|
|
12443
|
-
pointerPath;
|
|
12444
|
-
constructor(pointerPath) {
|
|
12445
|
-
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`);
|
|
12446
|
-
this.name = "StaleRevertModelError";
|
|
12447
|
-
this.pointerPath = pointerPath;
|
|
12448
|
-
}
|
|
12449
|
-
};
|
|
12450
|
-
function assertPriorUnchanged(model, ops) {
|
|
12451
|
-
for (const op of ops) {
|
|
12452
|
-
if (op.prior === void 0) continue;
|
|
12453
|
-
if (!deepEqual(getAt(model, pointerSegs(op.path)), op.prior)) throw new StaleRevertModelError(op.path);
|
|
12454
|
-
}
|
|
12455
|
-
}
|
|
12456
|
-
function getAt(root, segs) {
|
|
12457
|
-
let node = root;
|
|
12458
|
-
for (const seg of segs) {
|
|
12459
|
-
if (node === null || typeof node !== "object") return void 0;
|
|
12460
|
-
node = node[seg];
|
|
12461
|
-
}
|
|
12462
|
-
return node;
|
|
12463
|
-
}
|
|
12464
12566
|
function applyOps(model, ops) {
|
|
12465
12567
|
const out = structuredClone(model);
|
|
12466
12568
|
for (const op of ops) {
|
|
12467
|
-
const segs =
|
|
12569
|
+
const segs = op.path.split("/").slice(1).map(unescape);
|
|
12468
12570
|
if (op.op === "add") setAt(out, segs, op.value);
|
|
12469
12571
|
else removeAt(out, segs);
|
|
12470
12572
|
}
|
|
@@ -12502,12 +12604,10 @@ const assertOpsConsumed = (resourceType, ops, handled) => {
|
|
|
12502
12604
|
async function desiredModel(type, ctx, ops) {
|
|
12503
12605
|
const reader = SDK_OVERRIDES[type];
|
|
12504
12606
|
const current = (reader && await reader(ctx)) ?? {};
|
|
12505
|
-
|
|
12607
|
+
return applyOps(current.PolicyDocument === void 0 ? current : {
|
|
12506
12608
|
...current,
|
|
12507
12609
|
PolicyDocument: canonicalizeForCompare(current.PolicyDocument)
|
|
12508
|
-
};
|
|
12509
|
-
assertPriorUnchanged(aligned, ops);
|
|
12510
|
-
return applyOps(aligned, ops);
|
|
12610
|
+
}, ops);
|
|
12511
12611
|
}
|
|
12512
12612
|
const policyJson = (m) => m.PolicyDocument === void 0 ? void 0 : JSON.stringify(m.PolicyDocument);
|
|
12513
12613
|
const writeS3BucketPolicy = async (ctx, ops) => {
|
|
@@ -12867,9 +12967,7 @@ const writeWafv2WebAcl = async (ctx, ops) => {
|
|
|
12867
12967
|
Scope: scope
|
|
12868
12968
|
}));
|
|
12869
12969
|
if (!cur.WebACL || !cur.LockToken) throw new Error("could not read current WebACL for revert");
|
|
12870
|
-
const
|
|
12871
|
-
assertPriorUnchanged(alignedWebAcl, ops);
|
|
12872
|
-
const m = applyOps(alignedWebAcl, ops);
|
|
12970
|
+
const m = applyOps(canonicalizeForCompare(cur.WebACL), ops);
|
|
12873
12971
|
const desc = m.Description;
|
|
12874
12972
|
await c.send(new UpdateWebACLCommand({
|
|
12875
12973
|
Name: name,
|