cdk-real-drift 0.2.24 → 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 +34 -6
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -3646,6 +3646,17 @@ const CC_ALT_REPRESENTATION = {
|
|
|
3646
3646
|
},
|
|
3647
3647
|
"AWS::ElasticLoadBalancingV2::LoadBalancer": { SubnetMappings: "Subnets" }
|
|
3648
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
|
+
}
|
|
3649
3660
|
const IAM_ATTACHMENT_SUBSET = { "AWS::IAM::ManagedPolicy": new Set([
|
|
3650
3661
|
"Roles",
|
|
3651
3662
|
"Users",
|
|
@@ -3911,6 +3922,8 @@ function classifyResource(resource, liveRaw, schema, opts = {}) {
|
|
|
3911
3922
|
path: k,
|
|
3912
3923
|
note: "write-only — cannot be read back"
|
|
3913
3924
|
});
|
|
3925
|
+
const twinSources = {};
|
|
3926
|
+
for (const src of Object.values(SHAPE_ECHO_TWIN[resourceType] ?? {})) if (isNestedObject(declared[src])) twinSources[src] = declared[src];
|
|
3914
3927
|
deepStripPaths(declared, schema.writeOnlyPaths);
|
|
3915
3928
|
const sibling = resource.siblingPolicyNames;
|
|
3916
3929
|
if (sibling !== void 0 && sibling !== "unresolved" && Array.isArray(live.Policies)) {
|
|
@@ -4439,6 +4452,12 @@ function classifyResource(resource, liveRaw, schema, opts = {}) {
|
|
|
4439
4452
|
});
|
|
4440
4453
|
continue;
|
|
4441
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
|
+
}
|
|
4442
4461
|
findings.push({
|
|
4443
4462
|
tier: "undeclared",
|
|
4444
4463
|
logicalId,
|
|
@@ -10476,8 +10495,10 @@ const REVERT_SET_DEFAULT_PATHS = new Set([
|
|
|
10476
10495
|
"AWS::SNS::Subscription\0FilterPolicyScope",
|
|
10477
10496
|
"AWS::InternetMonitor::Monitor\0Status",
|
|
10478
10497
|
"AWS::RolesAnywhere::Profile\0DurationSeconds",
|
|
10479
|
-
"AWS::RolesAnywhere::Profile\0AttributeMappings"
|
|
10498
|
+
"AWS::RolesAnywhere::Profile\0AttributeMappings",
|
|
10499
|
+
"AWS::EC2::Subnet\0EnableDns64"
|
|
10480
10500
|
]);
|
|
10501
|
+
const REVERT_SET_DEFAULT_VALUES = { "AWS::EC2::Subnet\0EnableDns64": false };
|
|
10481
10502
|
/**
|
|
10482
10503
|
* A nested undeclared value (a live sub-key inside a declared object, R96/R98) — a dotted
|
|
10483
10504
|
* path (`Conf.Destination`) or an identity-keyed array element (`Prop[<id>].sub`). Pure +
|
|
@@ -10743,8 +10764,9 @@ function revertOp(f, recorded) {
|
|
|
10743
10764
|
prior: f.actual,
|
|
10744
10765
|
human: `${f.path} -> baseline value`
|
|
10745
10766
|
};
|
|
10746
|
-
const
|
|
10747
|
-
|
|
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 {
|
|
10748
10770
|
op: "add",
|
|
10749
10771
|
path: pointer,
|
|
10750
10772
|
value: knownDefault,
|
|
@@ -10836,7 +10858,8 @@ const CC_UPDATE_REJECTED_EMPTY_PATHS = {
|
|
|
10836
10858
|
"/Distributions/*/AmiDistributionConfiguration/TargetAccountIds",
|
|
10837
10859
|
"/Distributions/*/FastLaunchConfigurations",
|
|
10838
10860
|
"/Distributions/*/LaunchTemplateConfigurations"
|
|
10839
|
-
]
|
|
10861
|
+
],
|
|
10862
|
+
"AWS::Lambda::EventInvokeConfig": ["/DestinationConfig/OnSuccess", "/DestinationConfig/OnFailure"]
|
|
10840
10863
|
};
|
|
10841
10864
|
function expandPointer(model, pointer) {
|
|
10842
10865
|
let frontier = [{
|
|
@@ -10861,17 +10884,22 @@ function expandPointer(model, pointer) {
|
|
|
10861
10884
|
value: node
|
|
10862
10885
|
}));
|
|
10863
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
|
+
}
|
|
10864
10892
|
function rejectedEmptyStripOps(resourceType, ops, liveRaw) {
|
|
10865
10893
|
const pointers = CC_UPDATE_REJECTED_EMPTY_PATHS[resourceType];
|
|
10866
10894
|
if (!pointers || !liveRaw || ops.length === 0) return [];
|
|
10867
10895
|
const out = [];
|
|
10868
10896
|
for (const pointer of pointers) for (const { pointer: concrete, value } of expandPointer(liveRaw, pointer)) {
|
|
10869
|
-
if (!
|
|
10897
|
+
if (!isEmptyHusk(value)) continue;
|
|
10870
10898
|
if (ops.some((o) => concrete === o.path || concrete.startsWith(`${o.path}/`))) continue;
|
|
10871
10899
|
out.push({
|
|
10872
10900
|
op: "remove",
|
|
10873
10901
|
path: concrete,
|
|
10874
|
-
human: `${concrete.slice(1).replaceAll("/", ".")} -> drop service-echoed empty
|
|
10902
|
+
human: `${concrete.slice(1).replaceAll("/", ".")} -> drop service-echoed empty husk (service rejects it on update)`
|
|
10875
10903
|
});
|
|
10876
10904
|
}
|
|
10877
10905
|
return out;
|