cdk-real-drift 0.23.6 → 0.23.7
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 +111 -24
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -4055,16 +4055,39 @@ const CASE_INSENSITIVE_PATHS = {
|
|
|
4055
4055
|
"AWS::Batch::ComputeEnvironment": new Set(["Type"]),
|
|
4056
4056
|
"AWS::Batch::JobDefinition": new Set(["Type"]),
|
|
4057
4057
|
"AWS::EMRServerless::Application": new Set(["Type"]),
|
|
4058
|
-
"AWS::RDS::DBInstance": new Set([
|
|
4059
|
-
|
|
4058
|
+
"AWS::RDS::DBInstance": new Set([
|
|
4059
|
+
"DBInstanceIdentifier",
|
|
4060
|
+
"DBParameterGroupName",
|
|
4061
|
+
"DBSubnetGroupName",
|
|
4062
|
+
"OptionGroupName",
|
|
4063
|
+
"DBClusterIdentifier"
|
|
4064
|
+
]),
|
|
4065
|
+
"AWS::RDS::DBCluster": new Set([
|
|
4066
|
+
"DBClusterIdentifier",
|
|
4067
|
+
"DBClusterParameterGroupName",
|
|
4068
|
+
"DBSubnetGroupName"
|
|
4069
|
+
]),
|
|
4060
4070
|
"AWS::ElastiCache::SubnetGroup": new Set(["CacheSubnetGroupName"]),
|
|
4061
|
-
"AWS::ElastiCache::ReplicationGroup": new Set(["ReplicationGroupId"]),
|
|
4062
|
-
"AWS::ElastiCache::CacheCluster": new Set(["ClusterName"]),
|
|
4063
|
-
"AWS::DocDB::DBCluster": new Set([
|
|
4064
|
-
|
|
4071
|
+
"AWS::ElastiCache::ReplicationGroup": new Set(["ReplicationGroupId", "CacheSubnetGroupName"]),
|
|
4072
|
+
"AWS::ElastiCache::CacheCluster": new Set(["ClusterName", "CacheSubnetGroupName"]),
|
|
4073
|
+
"AWS::DocDB::DBCluster": new Set([
|
|
4074
|
+
"DBClusterIdentifier",
|
|
4075
|
+
"DBSubnetGroupName",
|
|
4076
|
+
"DBClusterParameterGroupName"
|
|
4077
|
+
]),
|
|
4078
|
+
"AWS::DocDB::DBInstance": new Set(["DBInstanceIdentifier", "DBClusterIdentifier"]),
|
|
4065
4079
|
"AWS::DocDB::DBSubnetGroup": new Set(["DBSubnetGroupName"]),
|
|
4066
|
-
"AWS::Neptune::DBCluster": new Set([
|
|
4067
|
-
|
|
4080
|
+
"AWS::Neptune::DBCluster": new Set([
|
|
4081
|
+
"DBClusterIdentifier",
|
|
4082
|
+
"DBSubnetGroupName",
|
|
4083
|
+
"DBClusterParameterGroupName"
|
|
4084
|
+
]),
|
|
4085
|
+
"AWS::Neptune::DBInstance": new Set([
|
|
4086
|
+
"DBInstanceIdentifier",
|
|
4087
|
+
"DBClusterIdentifier",
|
|
4088
|
+
"DBParameterGroupName",
|
|
4089
|
+
"DBSubnetGroupName"
|
|
4090
|
+
]),
|
|
4068
4091
|
"AWS::Neptune::DBSubnetGroup": new Set(["DBSubnetGroupName"]),
|
|
4069
4092
|
"AWS::RDS::DBParameterGroup": new Set(["DBParameterGroupName"]),
|
|
4070
4093
|
"AWS::RDS::DBClusterParameterGroup": new Set(["DBClusterParameterGroupName"]),
|
|
@@ -4074,8 +4097,12 @@ const CASE_INSENSITIVE_PATHS = {
|
|
|
4074
4097
|
"AWS::Neptune::DBClusterParameterGroup": new Set(["Name"]),
|
|
4075
4098
|
"AWS::DocDB::DBClusterParameterGroup": new Set(["Name"]),
|
|
4076
4099
|
"AWS::Redshift::ClusterParameterGroup": new Set(["ParameterGroupName"]),
|
|
4077
|
-
"AWS::Redshift::Cluster": new Set([
|
|
4078
|
-
|
|
4100
|
+
"AWS::Redshift::Cluster": new Set([
|
|
4101
|
+
"ClusterIdentifier",
|
|
4102
|
+
"ClusterParameterGroupName",
|
|
4103
|
+
"ClusterSubnetGroupName"
|
|
4104
|
+
]),
|
|
4105
|
+
"AWS::DMS::ReplicationInstance": new Set(["ReplicationInstanceIdentifier", "ReplicationSubnetGroupIdentifier"]),
|
|
4079
4106
|
"AWS::DMS::ReplicationSubnetGroup": new Set(["ReplicationSubnetGroupIdentifier"]),
|
|
4080
4107
|
"AWS::DAX::ParameterGroup": new Set(["ParameterGroupName"]),
|
|
4081
4108
|
"AWS::DAX::SubnetGroup": new Set(["SubnetGroupName"]),
|
|
@@ -4565,6 +4592,7 @@ function alignNameValueSubset(declared, live, spec) {
|
|
|
4565
4592
|
return live.filter((e) => !dm.has(e[spec.nameField]));
|
|
4566
4593
|
}
|
|
4567
4594
|
const UNORDERED_ARRAY_PROPS = {
|
|
4595
|
+
"AWS::Route53::CidrCollection": new Set(["Locations.*.CidrList"]),
|
|
4568
4596
|
"AWS::CloudFront::Distribution": new Set(["DistributionConfig.Restrictions.GeoRestriction.Locations"]),
|
|
4569
4597
|
"AWS::Cognito::UserPool": new Set(["EnabledMfas"]),
|
|
4570
4598
|
"AWS::ECS::Cluster": new Set(["CapacityProviders"]),
|
|
@@ -5478,6 +5506,23 @@ function isLogGroupArnWildcardMatch(desired, actual) {
|
|
|
5478
5506
|
return stripLogGroupWildcard(desired) === stripLogGroupWildcard(actual);
|
|
5479
5507
|
}
|
|
5480
5508
|
|
|
5509
|
+
//#endregion
|
|
5510
|
+
//#region src/normalize/derived-defaults.ts
|
|
5511
|
+
function route53HealthCheckDerivedPort(hcType) {
|
|
5512
|
+
return hcType === "HTTP" || hcType === "HTTP_STR_MATCH" ? 80 : hcType === "HTTPS" || hcType === "HTTPS_STR_MATCH" ? 443 : void 0;
|
|
5513
|
+
}
|
|
5514
|
+
function elbTargetGroupDerivedHealthCheckProtocol(protocol, targetType) {
|
|
5515
|
+
if (protocol === "GENEVE") return "TCP";
|
|
5516
|
+
if (protocol === "HTTPS") return "HTTPS";
|
|
5517
|
+
if ((protocol === "TCP" || protocol === "TLS" || protocol === "UDP" || protocol === "TCP_UDP") && targetType !== "alb") return "TCP";
|
|
5518
|
+
}
|
|
5519
|
+
function elbTargetGroupDerivedHealthCheckPort(protocol) {
|
|
5520
|
+
return protocol === "GENEVE" ? "80" : void 0;
|
|
5521
|
+
}
|
|
5522
|
+
function rdsReplicaDerivedBackupRetention(sourceDbInstanceIdentifier) {
|
|
5523
|
+
return sourceDbInstanceIdentifier !== void 0 ? 0 : void 0;
|
|
5524
|
+
}
|
|
5525
|
+
|
|
5481
5526
|
//#endregion
|
|
5482
5527
|
//#region src/read/kms-aliases.ts
|
|
5483
5528
|
const cache$1 = /* @__PURE__ */ new Map();
|
|
@@ -7164,11 +7209,14 @@ function classifyResource(resource, liveRaw, schema, opts = {}) {
|
|
|
7164
7209
|
HealthCheckTimeoutSeconds: 6,
|
|
7165
7210
|
Matcher: { HttpCode: "200-399" }
|
|
7166
7211
|
} : {},
|
|
7167
|
-
...
|
|
7168
|
-
|
|
7169
|
-
|
|
7170
|
-
|
|
7171
|
-
|
|
7212
|
+
...(() => {
|
|
7213
|
+
const hcProto = elbTargetGroupDerivedHealthCheckProtocol(protocol, targetType);
|
|
7214
|
+
const hcPort = elbTargetGroupDerivedHealthCheckPort(protocol);
|
|
7215
|
+
return {
|
|
7216
|
+
...hcProto !== void 0 ? { HealthCheckProtocol: hcProto } : {},
|
|
7217
|
+
...hcPort !== void 0 ? { HealthCheckPort: hcPort } : {}
|
|
7218
|
+
};
|
|
7219
|
+
})(),
|
|
7172
7220
|
...protocolVersion === "GRPC" ? { Matcher: { GrpcCode: "12" } } : {}
|
|
7173
7221
|
};
|
|
7174
7222
|
}
|
|
@@ -7262,7 +7310,6 @@ function classifyResource(resource, liveRaw, schema, opts = {}) {
|
|
|
7262
7310
|
const proto = declared["Protocol"];
|
|
7263
7311
|
if (typeof proto === "string" && (proto === "TCP" || proto === "TLS" || proto === "UDP" || proto === "TCP_UDP") && declared["TargetType"] !== "alb") knownDef = {
|
|
7264
7312
|
...knownDef,
|
|
7265
|
-
HealthCheckProtocol: "TCP",
|
|
7266
7313
|
HealthCheckTimeoutSeconds: 10
|
|
7267
7314
|
};
|
|
7268
7315
|
}
|
|
@@ -7335,7 +7382,7 @@ function classifyResource(resource, liveRaw, schema, opts = {}) {
|
|
|
7335
7382
|
if (resourceType === "AWS::RDS::DBInstance" && rdsReplicaSourceId !== void 0) {
|
|
7336
7383
|
knownDef = {
|
|
7337
7384
|
...knownDef,
|
|
7338
|
-
BackupRetentionPeriod: 0
|
|
7385
|
+
BackupRetentionPeriod: rdsReplicaDerivedBackupRetention(rdsReplicaSourceId) ?? 0
|
|
7339
7386
|
};
|
|
7340
7387
|
const src = opts.siblingRdsSourceModels?.[rdsReplicaSourceId];
|
|
7341
7388
|
if (src) {
|
|
@@ -7343,7 +7390,9 @@ function classifyResource(resource, liveRaw, schema, opts = {}) {
|
|
|
7343
7390
|
for (const k of [
|
|
7344
7391
|
"Engine",
|
|
7345
7392
|
"AllocatedStorage",
|
|
7346
|
-
"MasterUsername"
|
|
7393
|
+
"MasterUsername",
|
|
7394
|
+
"DBParameterGroupName",
|
|
7395
|
+
"DBSubnetGroupName"
|
|
7347
7396
|
]) if (src[k] !== void 0) inherit[k] = src[k];
|
|
7348
7397
|
knownDef = {
|
|
7349
7398
|
...knownDef,
|
|
@@ -7353,7 +7402,7 @@ function classifyResource(resource, liveRaw, schema, opts = {}) {
|
|
|
7353
7402
|
}
|
|
7354
7403
|
if (resourceType === "AWS::Route53::HealthCheck") {
|
|
7355
7404
|
const hcType = declared["HealthCheckConfig"]?.["Type"];
|
|
7356
|
-
const defaultPort = hcType
|
|
7405
|
+
const defaultPort = route53HealthCheckDerivedPort(hcType);
|
|
7357
7406
|
if (defaultPort !== void 0) knownDefPaths = {
|
|
7358
7407
|
...knownDefPaths,
|
|
7359
7408
|
"HealthCheckConfig.Port": defaultPort
|
|
@@ -15635,8 +15684,8 @@ async function regatherTouched(gathered, touched, region) {
|
|
|
15635
15684
|
clusterEchoModel: buildClusterEchoModels(desired),
|
|
15636
15685
|
scalableTargetBands: buildScalableTargetBands(desired),
|
|
15637
15686
|
siblingClientVpnEndpointVpcs: buildClientVpnEndpointSiblingVpcs(desired),
|
|
15638
|
-
siblingCloudFrontCdPolicyIds: buildCloudFrontStagingDistCdPolicyIds(desired, liveModelMap(reads)),
|
|
15639
|
-
siblingRdsSourceModels: buildRdsReplicaSourceModels(desired, liveModelMap(reads)),
|
|
15687
|
+
siblingCloudFrontCdPolicyIds: buildCloudFrontStagingDistCdPolicyIds(desired, new Map([...gathered.liveByLogical, ...liveModelMap(reads)])),
|
|
15688
|
+
siblingRdsSourceModels: buildRdsReplicaSourceModels(desired, new Map([...gathered.liveByLogical, ...liveModelMap(reads)])),
|
|
15640
15689
|
rdsOptionSettingDefaults: await buildRdsOptionSettingDefaults(desired, region)
|
|
15641
15690
|
};
|
|
15642
15691
|
const fresh = [];
|
|
@@ -19689,6 +19738,7 @@ const REVERT_SET_DEFAULT_PATHS = new Set([
|
|
|
19689
19738
|
"AWS::RDS::DBInstance\0MonitoringInterval",
|
|
19690
19739
|
"AWS::RDS::DBInstance\0CopyTagsToSnapshot",
|
|
19691
19740
|
"AWS::RDS::DBInstance\0CACertificateIdentifier",
|
|
19741
|
+
"AWS::EC2::Volume\0VolumeType",
|
|
19692
19742
|
"AWS::RDS::DBCluster\0AutoMinorVersionUpgrade",
|
|
19693
19743
|
"AWS::Neptune::DBInstance\0AutoMinorVersionUpgrade",
|
|
19694
19744
|
"AWS::ElastiCache::CacheCluster\0AutoMinorVersionUpgrade",
|
|
@@ -20087,7 +20137,8 @@ function buildRevertPlan(findings, baseline, opts = {}) {
|
|
|
20087
20137
|
desired: [...f.desired, ...sib]
|
|
20088
20138
|
};
|
|
20089
20139
|
}
|
|
20090
|
-
const
|
|
20140
|
+
const declaredModel = opts.declaredForLogical?.(f.logicalId);
|
|
20141
|
+
const op = revertOp(toRevert, recorded, opts.identity, declaredModel);
|
|
20091
20142
|
const key = `${f.logicalId} ${kind}${propScoped ? ` ${f.path}` : ""}`;
|
|
20092
20143
|
const item = itemsByLogical.get(key) ?? {
|
|
20093
20144
|
logicalId: f.logicalId,
|
|
@@ -20098,6 +20149,20 @@ function buildRevertPlan(findings, baseline, opts = {}) {
|
|
|
20098
20149
|
ops: []
|
|
20099
20150
|
};
|
|
20100
20151
|
item.ops.push(op);
|
|
20152
|
+
if (kind === "cc" && op.op === "add") {
|
|
20153
|
+
const live = opts.liveByLogical?.get(f.logicalId);
|
|
20154
|
+
for (const sibling of REVERT_COMPANION_REMOVES[`${f.resourceType}\0${f.path}`]?.(op.value) ?? []) {
|
|
20155
|
+
if (declaredModel?.[sibling] !== void 0) continue;
|
|
20156
|
+
if (!live || live[sibling] === void 0) continue;
|
|
20157
|
+
const siblingPointer = `/${sibling}`;
|
|
20158
|
+
if (item.ops.some((o) => o.path === siblingPointer)) continue;
|
|
20159
|
+
item.ops.push({
|
|
20160
|
+
op: "remove",
|
|
20161
|
+
path: siblingPointer,
|
|
20162
|
+
human: `${sibling} -> remove (incompatible with the restored default)`
|
|
20163
|
+
});
|
|
20164
|
+
}
|
|
20165
|
+
}
|
|
20101
20166
|
itemsByLogical.set(key, item);
|
|
20102
20167
|
}
|
|
20103
20168
|
if (opts.liveByLogical) for (const item of itemsByLogical.values()) {
|
|
@@ -20137,7 +20202,20 @@ function contextArnDefaultFor(resourceType, path, identity) {
|
|
|
20137
20202
|
const substitute = (t) => t.replace("{partition}", partition).replace("{region}", region).replace("{accountId}", accountId);
|
|
20138
20203
|
return Array.isArray(template) ? template.map(substitute) : substitute(template);
|
|
20139
20204
|
}
|
|
20140
|
-
function
|
|
20205
|
+
function derivedRevertDefaultFor(resourceType, path, declared) {
|
|
20206
|
+
if (!declared) return void 0;
|
|
20207
|
+
if (resourceType === "AWS::Route53::HealthCheck" && path === "HealthCheckConfig.Port") return route53HealthCheckDerivedPort(declared["HealthCheckConfig"]?.["Type"]);
|
|
20208
|
+
if (resourceType === "AWS::ElasticLoadBalancingV2::TargetGroup") {
|
|
20209
|
+
if (path === "HealthCheckProtocol") return elbTargetGroupDerivedHealthCheckProtocol(declared["Protocol"], declared["TargetType"]);
|
|
20210
|
+
if (path === "HealthCheckPort") return elbTargetGroupDerivedHealthCheckPort(declared["Protocol"]);
|
|
20211
|
+
}
|
|
20212
|
+
if (resourceType === "AWS::RDS::DBInstance" && path === "BackupRetentionPeriod") return rdsReplicaDerivedBackupRetention(declared["SourceDBInstanceIdentifier"]);
|
|
20213
|
+
}
|
|
20214
|
+
const REVERT_COMPANION_REMOVES = {
|
|
20215
|
+
"AWS::ElasticLoadBalancingV2::TargetGroup\0HealthCheckProtocol": (value) => value === "TCP" ? ["Matcher", "HealthCheckPath"] : [],
|
|
20216
|
+
"AWS::EC2::Volume\0VolumeType": (value) => value === "gp2" || value === "standard" || value === "st1" || value === "sc1" ? ["Iops", "Throughput"] : value === "io1" || value === "io2" ? ["Throughput"] : []
|
|
20217
|
+
};
|
|
20218
|
+
function revertOp(f, recorded, identity, declaredModel) {
|
|
20141
20219
|
const pointer = toPointer(f.path);
|
|
20142
20220
|
if (f.tier === "declared") return {
|
|
20143
20221
|
op: "add",
|
|
@@ -20161,6 +20239,14 @@ function revertOp(f, recorded, identity) {
|
|
|
20161
20239
|
prior: f.actual,
|
|
20162
20240
|
human: `${f.path} -> baseline value`
|
|
20163
20241
|
};
|
|
20242
|
+
const derivedDefault = derivedRevertDefaultFor(f.resourceType, f.path, declaredModel);
|
|
20243
|
+
if (derivedDefault !== void 0) return {
|
|
20244
|
+
op: "add",
|
|
20245
|
+
path: pointer,
|
|
20246
|
+
value: derivedDefault,
|
|
20247
|
+
prior: f.actual,
|
|
20248
|
+
human: `${f.path} -> AWS default (derived from declared inputs)`
|
|
20249
|
+
};
|
|
20164
20250
|
const setDefaultKey = `${f.resourceType}\0${f.path}`;
|
|
20165
20251
|
const knownDefault = KNOWN_DEFAULTS[f.resourceType]?.[f.path] ?? REVERT_SET_DEFAULT_VALUES[setDefaultKey] ?? contextArnDefaultFor(f.resourceType, f.path, identity);
|
|
20166
20252
|
if (knownDefault !== void 0 && REVERT_SET_DEFAULT_PATHS.has(setDefaultKey)) return {
|
|
@@ -21200,7 +21286,8 @@ async function revertStack(p) {
|
|
|
21200
21286
|
identity: {
|
|
21201
21287
|
accountId: gathered.desired.accountId,
|
|
21202
21288
|
region
|
|
21203
|
-
}
|
|
21289
|
+
},
|
|
21290
|
+
declaredForLogical
|
|
21204
21291
|
});
|
|
21205
21292
|
if (plan.items.length === 0 && plan.notRevertable.length === 0) {
|
|
21206
21293
|
out(style.clean(`${stackName} (${region}): no drift to revert.`));
|