cdk-real-drift 0.12.62 → 0.12.63
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 +103 -8
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -5942,6 +5942,86 @@ function remapSortedIndexToDeclared(path, arrayKey, sortedDeclared, rawDeclared)
|
|
|
5942
5942
|
const rawIdx = rawDeclared.findIndex((e) => deepEqual(e, el));
|
|
5943
5943
|
return rawIdx < 0 ? path : `${arrayKey}.${rawIdx}${m[2]}`;
|
|
5944
5944
|
}
|
|
5945
|
+
const S3_NOTIF_FILTER_RULE_NAMES = {
|
|
5946
|
+
prefix: "prefix",
|
|
5947
|
+
suffix: "suffix",
|
|
5948
|
+
Prefix: "prefix",
|
|
5949
|
+
Suffix: "suffix"
|
|
5950
|
+
};
|
|
5951
|
+
function canonS3NotifFilter(filter) {
|
|
5952
|
+
if (!filter || typeof filter !== "object") return filter;
|
|
5953
|
+
const f = filter;
|
|
5954
|
+
const inner = f.S3Key ?? f.Key;
|
|
5955
|
+
if (!inner || typeof inner !== "object") return filter;
|
|
5956
|
+
const rulesRaw = inner.Rules ?? inner.FilterRules;
|
|
5957
|
+
return { S3Key: { Rules: Array.isArray(rulesRaw) ? sortUnorderedObjectArray(rulesRaw.map((r) => {
|
|
5958
|
+
if (!r || typeof r !== "object") return r;
|
|
5959
|
+
const rule = r;
|
|
5960
|
+
const name = rule.Name;
|
|
5961
|
+
return {
|
|
5962
|
+
...rule,
|
|
5963
|
+
Name: typeof name === "string" ? S3_NOTIF_FILTER_RULE_NAMES[name] ?? name : name
|
|
5964
|
+
};
|
|
5965
|
+
})) : rulesRaw } };
|
|
5966
|
+
}
|
|
5967
|
+
function translateBucketNotificationConfigs(configs, arnKey, targetKey) {
|
|
5968
|
+
if (!Array.isArray(configs)) return [];
|
|
5969
|
+
const out = [];
|
|
5970
|
+
for (const c of configs) {
|
|
5971
|
+
if (!c || typeof c !== "object") {
|
|
5972
|
+
out.push(c);
|
|
5973
|
+
continue;
|
|
5974
|
+
}
|
|
5975
|
+
const { Events, Filter, [arnKey]: arn, ...rest } = c;
|
|
5976
|
+
const base = { ...rest };
|
|
5977
|
+
if (arn !== void 0) base[targetKey] = arn;
|
|
5978
|
+
if (Filter !== void 0) base.Filter = canonS3NotifFilter(Filter);
|
|
5979
|
+
const events = Array.isArray(Events) ? Events : Events !== void 0 ? [Events] : void 0;
|
|
5980
|
+
if (events && events.length > 0) for (const ev of events) out.push({
|
|
5981
|
+
...base,
|
|
5982
|
+
Event: ev
|
|
5983
|
+
});
|
|
5984
|
+
else out.push(base);
|
|
5985
|
+
}
|
|
5986
|
+
return out;
|
|
5987
|
+
}
|
|
5988
|
+
function canonS3NotifBucketConfig(config) {
|
|
5989
|
+
if (!config || typeof config !== "object" || Array.isArray(config)) return config;
|
|
5990
|
+
const c = config;
|
|
5991
|
+
const out = { ...c };
|
|
5992
|
+
for (const key of [
|
|
5993
|
+
"LambdaConfigurations",
|
|
5994
|
+
"QueueConfigurations",
|
|
5995
|
+
"TopicConfigurations"
|
|
5996
|
+
]) {
|
|
5997
|
+
const arr = c[key];
|
|
5998
|
+
if (!Array.isArray(arr)) continue;
|
|
5999
|
+
out[key] = sortUnorderedObjectArray(arr.map((entry) => {
|
|
6000
|
+
if (!entry || typeof entry !== "object") return entry;
|
|
6001
|
+
const e = entry;
|
|
6002
|
+
return "Filter" in e ? {
|
|
6003
|
+
...e,
|
|
6004
|
+
Filter: canonS3NotifFilter(e.Filter)
|
|
6005
|
+
} : e;
|
|
6006
|
+
}));
|
|
6007
|
+
}
|
|
6008
|
+
return out;
|
|
6009
|
+
}
|
|
6010
|
+
function translateDeclaredBucketNotification(declaredConfig) {
|
|
6011
|
+
const out = {};
|
|
6012
|
+
if ("EventBridgeConfiguration" in declaredConfig) out.EventBridgeConfiguration = declaredConfig.EventBridgeConfiguration;
|
|
6013
|
+
const lambda = translateBucketNotificationConfigs(declaredConfig.LambdaFunctionConfigurations ?? declaredConfig.LambdaConfigurations, "LambdaFunctionArn", "Function");
|
|
6014
|
+
if (lambda.length > 0) out.LambdaConfigurations = lambda;
|
|
6015
|
+
const queue = translateBucketNotificationConfigs(declaredConfig.QueueConfigurations, "QueueArn", "Queue");
|
|
6016
|
+
if (queue.length > 0) out.QueueConfigurations = queue;
|
|
6017
|
+
const topic = translateBucketNotificationConfigs(declaredConfig.TopicConfigurations, "TopicArn", "Topic");
|
|
6018
|
+
if (topic.length > 0) out.TopicConfigurations = topic;
|
|
6019
|
+
for (const [k, v] of Object.entries(declaredConfig)) {
|
|
6020
|
+
if (k === "EventBridgeConfiguration" || k === "LambdaFunctionConfigurations" || k === "LambdaConfigurations" || k === "QueueConfigurations" || k === "TopicConfigurations") continue;
|
|
6021
|
+
out[k] = v;
|
|
6022
|
+
}
|
|
6023
|
+
return out;
|
|
6024
|
+
}
|
|
5945
6025
|
function expandExecuteApiResources(policy, arnPrefix) {
|
|
5946
6026
|
if (!policy || typeof policy !== "object" || Array.isArray(policy)) return policy;
|
|
5947
6027
|
const p = policy;
|
|
@@ -6131,7 +6211,9 @@ function classifyResource(resource, liveRaw, schema, opts = {}) {
|
|
|
6131
6211
|
const selfDeclared = declaresTarget(declared.InstanceId) || declaresTarget(declared.NetworkInterfaceId);
|
|
6132
6212
|
if (explained || selfDeclared) delete live.NetworkInterfaceId;
|
|
6133
6213
|
}
|
|
6134
|
-
if (resourceType === "AWS::S3::Bucket" && physicalId && opts.bucketNotificationManaged?.has(physicalId) && !("NotificationConfiguration" in declared))
|
|
6214
|
+
if (resourceType === "AWS::S3::Bucket" && physicalId && opts.bucketNotificationManaged?.has(physicalId) && !("NotificationConfiguration" in declared)) {
|
|
6215
|
+
if (deepEqual(canonicalizeForCompare(canonS3NotifBucketConfig(translateDeclaredBucketNotification(opts.bucketNotificationConfigs?.[physicalId] ?? {})), resourceType), canonicalizeForCompare(canonS3NotifBucketConfig(live.NotificationConfiguration), resourceType))) delete live.NotificationConfiguration;
|
|
6216
|
+
}
|
|
6135
6217
|
const echoSpec = CLUSTER_ECHO_CHILD[resourceType];
|
|
6136
6218
|
const echoModel = echoSpec && physicalId ? opts.clusterEchoModel?.[physicalId] : void 0;
|
|
6137
6219
|
if (echoSpec && echoModel) for (const k of Object.keys(live)) {
|
|
@@ -12299,22 +12381,33 @@ function buildSiblingEventBusPolicies(desired) {
|
|
|
12299
12381
|
return map;
|
|
12300
12382
|
}
|
|
12301
12383
|
const S3_NOTIFICATIONS_CR_TYPE = "Custom::S3BucketNotifications";
|
|
12302
|
-
function
|
|
12384
|
+
function resolveBucketNotificationCrs(desired) {
|
|
12303
12385
|
const byLogicalId = /* @__PURE__ */ new Map();
|
|
12304
12386
|
for (const r of desired.resources) if (r.physicalId) byLogicalId.set(r.logicalId, r.physicalId);
|
|
12305
|
-
const
|
|
12387
|
+
const out = [];
|
|
12306
12388
|
for (const r of desired.resources) {
|
|
12307
12389
|
if (r.resourceType !== S3_NOTIFICATIONS_CR_TYPE) continue;
|
|
12308
12390
|
const decl = r.declared;
|
|
12309
12391
|
if (!decl || typeof decl !== "object") continue;
|
|
12310
|
-
const
|
|
12311
|
-
|
|
12392
|
+
const d = decl;
|
|
12393
|
+
const bucketName = d.BucketName;
|
|
12394
|
+
const rawConfig = d.NotificationConfiguration;
|
|
12395
|
+
const config = rawConfig && typeof rawConfig === "object" && !Array.isArray(rawConfig) ? rawConfig : {};
|
|
12396
|
+
if (typeof bucketName === "string" && bucketName) out.push([bucketName, config]);
|
|
12312
12397
|
else if (bucketName && typeof bucketName === "object" && "Ref" in bucketName) {
|
|
12313
12398
|
const phys = byLogicalId.get(bucketName.Ref);
|
|
12314
|
-
if (phys)
|
|
12399
|
+
if (phys) out.push([phys, config]);
|
|
12315
12400
|
}
|
|
12316
12401
|
}
|
|
12317
|
-
return
|
|
12402
|
+
return out;
|
|
12403
|
+
}
|
|
12404
|
+
function buildBucketNotificationManaged(desired) {
|
|
12405
|
+
return new Set(resolveBucketNotificationCrs(desired).map(([phys]) => phys));
|
|
12406
|
+
}
|
|
12407
|
+
function buildBucketNotificationConfigs(desired) {
|
|
12408
|
+
const out = {};
|
|
12409
|
+
for (const [phys, config] of resolveBucketNotificationCrs(desired)) out[phys] = config;
|
|
12410
|
+
return out;
|
|
12318
12411
|
}
|
|
12319
12412
|
const MANAGED_POLICY_TYPE = "AWS::IAM::ManagedPolicy";
|
|
12320
12413
|
const MANAGED_POLICY_ATTACH_SIDES = [
|
|
@@ -12710,6 +12803,7 @@ async function gatherFindings(stackName, region, templateOverride, recoveryTempl
|
|
|
12710
12803
|
siblingEipAssociations: buildSiblingEipAssociations(desired),
|
|
12711
12804
|
siblingTargetGroupRegistrars: buildSiblingTargetGroupRegistrars(desired),
|
|
12712
12805
|
bucketNotificationManaged: buildBucketNotificationManaged(desired),
|
|
12806
|
+
bucketNotificationConfigs: buildBucketNotificationConfigs(desired),
|
|
12713
12807
|
clusterEchoModel: buildClusterEchoModels(desired),
|
|
12714
12808
|
rdsOptionSettingDefaults: await buildRdsOptionSettingDefaults(desired, region)
|
|
12715
12809
|
};
|
|
@@ -12780,6 +12874,7 @@ async function regatherTouched(gathered, touched, region) {
|
|
|
12780
12874
|
siblingEipAssociations: buildSiblingEipAssociations(desired),
|
|
12781
12875
|
siblingTargetGroupRegistrars: buildSiblingTargetGroupRegistrars(desired),
|
|
12782
12876
|
bucketNotificationManaged: buildBucketNotificationManaged(desired),
|
|
12877
|
+
bucketNotificationConfigs: buildBucketNotificationConfigs(desired),
|
|
12783
12878
|
clusterEchoModel: buildClusterEchoModels(desired),
|
|
12784
12879
|
rdsOptionSettingDefaults: await buildRdsOptionSettingDefaults(desired, region)
|
|
12785
12880
|
};
|
|
@@ -16369,7 +16464,7 @@ function isUnderCreateOnly(findingPath, createOnlyPaths) {
|
|
|
16369
16464
|
}
|
|
16370
16465
|
return false;
|
|
16371
16466
|
}
|
|
16372
|
-
const CC_DELETE_UNSUPPORTED_ADDED_TYPES = new Set(["AWS::EC2::NetworkAclEntry"]);
|
|
16467
|
+
const CC_DELETE_UNSUPPORTED_ADDED_TYPES = new Set(["AWS::EC2::NetworkAclEntry", "AWS::Route53::RecordSet"]);
|
|
16373
16468
|
function buildRevertPlan(findings, baseline, opts = {}) {
|
|
16374
16469
|
const itemsByLogical = /* @__PURE__ */ new Map();
|
|
16375
16470
|
const notRevertable = [];
|