cdk-real-drift 0.4.27 → 0.4.28
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 +37 -4
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -10113,6 +10113,23 @@ function stackCountAnnouncement(stackNames) {
|
|
|
10113
10113
|
|
|
10114
10114
|
//#endregion
|
|
10115
10115
|
//#region src/baseline/baseline-file.ts
|
|
10116
|
+
const KNOWN_BASELINE_KEYS = new Set([
|
|
10117
|
+
"schemaVersion",
|
|
10118
|
+
"stackName",
|
|
10119
|
+
"region",
|
|
10120
|
+
"accountId",
|
|
10121
|
+
"capturedAt",
|
|
10122
|
+
"templateHash",
|
|
10123
|
+
"recorded",
|
|
10124
|
+
"completeResources",
|
|
10125
|
+
"recordedPhysicalIds"
|
|
10126
|
+
]);
|
|
10127
|
+
const KNOWN_RECORDED_ENTRY_KEYS = new Set([
|
|
10128
|
+
"logicalId",
|
|
10129
|
+
"resourceType",
|
|
10130
|
+
"path",
|
|
10131
|
+
"value"
|
|
10132
|
+
]);
|
|
10116
10133
|
function baselinePath(stackName, accountId, region) {
|
|
10117
10134
|
return `.cdkrd/baselines/${stackName}.${accountId}.${region}.json`;
|
|
10118
10135
|
}
|
|
@@ -10142,6 +10159,8 @@ async function loadBaseline(stackName, accountId, region) {
|
|
|
10142
10159
|
if (parsed.schemaVersion !== void 0 && typeof parsed.schemaVersion !== "number") throw new Error(`baseline file ${path} has a non-numeric schemaVersion (${JSON.stringify(parsed.schemaVersion)}); it is malformed (corrupt or hand-edited)`);
|
|
10143
10160
|
if (typeof parsed.schemaVersion === "number" && parsed.schemaVersion > 2) throw new Error(`baseline file ${path} was written by a newer cdkrd (schemaVersion ${parsed.schemaVersion}); upgrade cdkrd`);
|
|
10144
10161
|
if (!Array.isArray(parsed.recorded)) throw new Error(`baseline file ${path} is malformed: \`recorded\` is missing or not an array`);
|
|
10162
|
+
const unknownTop = Object.keys(parsed).filter((k) => !KNOWN_BASELINE_KEYS.has(k));
|
|
10163
|
+
if (unknownTop.length > 0) throw new Error(`baseline file ${path}: unknown key(s) ${unknownTop.map((k) => `"${k}"`).join(", ")} — known keys: ${[...KNOWN_BASELINE_KEYS].map((k) => `"${k}"`).join(", ")} (a typo silently disables detection; correct or remove it)`);
|
|
10145
10164
|
parsed.recorded.forEach((entry, i) => validateRecordedEntry(entry, i, path));
|
|
10146
10165
|
validateRecordedUniqueness(parsed.recorded, path);
|
|
10147
10166
|
validateCompleteResources(parsed.completeResources, path);
|
|
@@ -10166,6 +10185,9 @@ function validateRecordedEntry(entry, index, path) {
|
|
|
10166
10185
|
"resourceType",
|
|
10167
10186
|
"path"
|
|
10168
10187
|
]) if (typeof obj[k] !== "string") throw new Error(`${at}: "${k}" is required and must be a string`);
|
|
10188
|
+
const unknown = Object.keys(obj).filter((k) => !KNOWN_RECORDED_ENTRY_KEYS.has(k));
|
|
10189
|
+
if (unknown.length > 0) throw new Error(`${at}: unknown key(s) ${unknown.map((k) => `"${k}"`).join(", ")} — known keys: "logicalId", "resourceType", "path", "value" (a typo'd "value" false-flags confirmed drift)`);
|
|
10190
|
+
if (!("value" in obj)) throw new Error(`${at}: "value" is required (use null for an empty value)`);
|
|
10169
10191
|
}
|
|
10170
10192
|
/**
|
|
10171
10193
|
* #1047: reject duplicate `recorded` identity keys at load. The baseline is git-committed,
|
|
@@ -11781,26 +11803,37 @@ const writeDaxCluster = async (ctx, ops) => {
|
|
|
11781
11803
|
const writeDaxParameterGroup = async (ctx, ops) => {
|
|
11782
11804
|
const name = str(ctx.physicalId) ?? str(ctx.declared["ParameterGroupName"]);
|
|
11783
11805
|
if (!name) throw new Error("cannot resolve DAX parameter-group name for revert");
|
|
11784
|
-
const
|
|
11806
|
+
const reader = SDK_OVERRIDES["AWS::DAX::ParameterGroup"];
|
|
11807
|
+
const live = (reader && await reader(ctx)) ?? {};
|
|
11808
|
+
const liveValues = live.ParameterNameValues ?? {};
|
|
11809
|
+
const desiredValues = applyOps(live, ops).ParameterNameValues ?? {};
|
|
11785
11810
|
const keys = /* @__PURE__ */ new Set();
|
|
11811
|
+
const unExpressible = /* @__PURE__ */ new Set();
|
|
11786
11812
|
for (const op of ops) {
|
|
11787
11813
|
const segs = op.path.replace(/^\//, "").split("/");
|
|
11788
11814
|
if (segs[0] !== "ParameterNameValues") continue;
|
|
11789
|
-
if (segs[1] !== void 0)
|
|
11815
|
+
if (segs[1] !== void 0) {
|
|
11816
|
+
const key = segs[1].replace(/~1/g, "/").replace(/~0/g, "~");
|
|
11817
|
+
if (op.op === "remove") unExpressible.add(key);
|
|
11818
|
+
else keys.add(key);
|
|
11819
|
+
} else if (op.op === "remove") for (const k of Object.keys(liveValues)) unExpressible.add(k);
|
|
11790
11820
|
else for (const k of Object.keys(desiredValues)) keys.add(k);
|
|
11791
11821
|
}
|
|
11792
11822
|
const values = [...keys].filter((k) => typeof desiredValues[k] === "string").map((k) => ({
|
|
11793
11823
|
ParameterName: k,
|
|
11794
11824
|
ParameterValue: desiredValues[k]
|
|
11795
11825
|
}));
|
|
11796
|
-
if (values.length
|
|
11797
|
-
await new DAXClient({
|
|
11826
|
+
if (values.length > 0) await new DAXClient({
|
|
11798
11827
|
region: ctx.region,
|
|
11799
11828
|
...CLIENT_TIMEOUTS
|
|
11800
11829
|
}).send(new UpdateParameterGroupCommand({
|
|
11801
11830
|
ParameterGroupName: name,
|
|
11802
11831
|
ParameterNameValues: values
|
|
11803
11832
|
}));
|
|
11833
|
+
if (unExpressible.size > 0) {
|
|
11834
|
+
const names = [...unExpressible].join(", ");
|
|
11835
|
+
throw new Error(`DAX ParameterGroup parameter ${names} cannot be cleared via UpdateParameterGroup (DAX has no ResetParameterGroup API, so an out-of-band-added parameter's unset state is not expressible)${values.length > 0 ? "; the other revert op(s) were applied" : ""}; update ${unExpressible.size > 1 ? "them" : "it"} manually`);
|
|
11836
|
+
}
|
|
11804
11837
|
};
|
|
11805
11838
|
const writeElastiCacheParameterGroup = async (ctx, ops) => {
|
|
11806
11839
|
const name = str(ctx.physicalId) ?? str(ctx.declared["CacheParameterGroupName"]);
|