@cdkd/cli 0.341.1 → 0.342.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/dist/{ambient-client-defaults-CtGTOtn9.js → ambient-client-defaults-3MwNEdTT.js} +4 -4
- package/dist/{ambient-client-defaults-CtGTOtn9.js.map → ambient-client-defaults-3MwNEdTT.js.map} +1 -1
- package/dist/{asg-provider-BAtESAWA.js → asg-provider-ApHZ6Mae.js} +5 -5
- package/dist/{asg-provider-BAtESAWA.js.map → asg-provider-ApHZ6Mae.js.map} +1 -1
- package/dist/{aws-client-defaults-BLXFsfMa.js → aws-client-defaults-BayGUTJ4.js} +31 -6
- package/dist/aws-client-defaults-BayGUTJ4.js.map +1 -0
- package/dist/{aws-clients-D3Z_tFc1.js → aws-clients-pNIHPxUe.js} +3 -2
- package/dist/aws-clients-pNIHPxUe.js.map +1 -0
- package/dist/cli.js +2 -2
- package/dist/{db-instance-modify-retry-DWfH-8xJ.js → db-instance-modify-retry-vrjXpAjl.js} +3 -3
- package/dist/{db-instance-modify-retry-DWfH-8xJ.js.map → db-instance-modify-retry-vrjXpAjl.js.map} +1 -1
- package/dist/{deploy-engine-CGUvIYNR.js → deploy-engine-B9WzTRxL.js} +261 -43
- package/dist/deploy-engine-B9WzTRxL.js.map +1 -0
- package/dist/{ecr-uri-XErmp-WT.js → ecr-uri-CLSVFzAB.js} +3 -3
- package/dist/{ecr-uri-XErmp-WT.js.map → ecr-uri-CLSVFzAB.js.map} +1 -1
- package/dist/{iam-role-provider-D9Q0YoPK.js → iam-role-provider-qyUDKsou.js} +5 -5
- package/dist/{iam-role-provider-D9Q0YoPK.js.map → iam-role-provider-qyUDKsou.js.map} +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -4
- package/dist/{neptune-provider-CdvFGM7h.js → neptune-provider-CZNhWtyQ.js} +6 -6
- package/dist/{neptune-provider-CdvFGM7h.js.map → neptune-provider-CZNhWtyQ.js.map} +1 -1
- package/dist/{program-DTlJetBn.js → program-CWnbFCjg.js} +221 -88
- package/dist/program-CWnbFCjg.js.map +1 -0
- package/dist/{provider-classes-BlYx16N0.js → provider-classes-9YIXh-it.js} +12 -12
- package/dist/{provider-classes-BlYx16N0.js.map → provider-classes-9YIXh-it.js.map} +1 -1
- package/dist/{rds-provider-Dexme8bI.js → rds-provider-CvaAoT1c.js} +246 -11
- package/dist/rds-provider-CvaAoT1c.js.map +1 -0
- package/dist/{read-replica-BZcBe5RN.js → read-replica-BA5570ms.js} +3 -3
- package/dist/{read-replica-BZcBe5RN.js.map → read-replica-BA5570ms.js.map} +1 -1
- package/dist/{update-removal-CNj3wKPR.js → update-removal-DLbbpOoJ.js} +3 -3
- package/dist/{update-removal-CNj3wKPR.js.map → update-removal-DLbbpOoJ.js.map} +1 -1
- package/dist/{version-B9pb2Csa.js → version-LNRY1BhV.js} +2 -2
- package/dist/{version-B9pb2Csa.js.map → version-LNRY1BhV.js.map} +1 -1
- package/package.json +2 -2
- package/dist/aws-client-defaults-BLXFsfMa.js.map +0 -1
- package/dist/aws-clients-D3Z_tFc1.js.map +0 -1
- package/dist/deploy-engine-CGUvIYNR.js.map +0 -1
- package/dist/program-DTlJetBn.js.map +0 -1
- package/dist/rds-provider-Dexme8bI.js.map +0 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { lt as safeMsg, n as describeAwsFailure, s as getLogger, x as coerceCfnBoolean, y as generatedNameFor } from "./aws-failure-text-zxW2CTmF.js";
|
|
2
|
-
import {
|
|
3
|
-
import { $ as deleteAfterProtectionFlipWithFinalSnapshot, B as resolveExplicitPhysicalId, H as assertRegionMatch, I as normalizeAwsTagsToCfn, It as maskerOrIdentity, J as observeThenDisableProtection, K as deleteWithProtectionCompensation, Kt as markAuxiliaryFailure, Lt as withDerivedNameMasks, Mt as createMaskedLogSinks, Q as PROTECTION_FLIP_RETRY_WAIT_MS, V as RESOURCE_NOT_FOUND, W as markNotGone, Y as rdsFamilyProtectionSite, a as withRemovalDefaults, f as retractCreatedResource, gt as protectedReplacementAdvice, ht as pasteableAwsCommand, it as ProtectionFlipRegistry, j as withoutServerErrorRetries, nt as isTerminalDbWaitStatus, ot as protectionFlipKey, qt as markCreatedBeforeFailure, t as clearOnUpdateRemoval, u as reportCreatedResource } from "./update-removal-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { a as associatedRoleList, c as canonicalAssociatedRoles, i as associatedRoleKey, l as isRoleCallNotAvailableRefusal, n as modifyDbInstanceWhenAvailable, o as associatedRolesNamed, r as associatedRoleArns, s as associatedRolesReadback, t as isModifyNotAvailableRefusal, u as planAssociatedRoleChanges } from "./db-instance-modify-retry-
|
|
7
|
-
import { a as refuseMalformedReplicaSource, c as replicaEngine, d as replicaSourceChange, f as replicaSourceOf, l as replicaModifyAfterCreateInput, m as withPreviousReplicaSource, n as isLiveReadReplica, o as refuseUnknownSourceRegion, p as sameReplicaSource, r as ownScopeOf, s as replicaCreateInput, t as describeReplicaSource, u as replicaNeedsModifyAfterCreate } from "./read-replica-
|
|
2
|
+
import { $ as CdkdError, G as markRedactedCause, K as wrapMaskedAwsError, O as relayedNameCollision, W as markNonRetryable, _ as ResourceUpdateNotSupportedError, it as ProvisioningError, t as ambientClientDefaults } from "./ambient-client-defaults-3MwNEdTT.js";
|
|
3
|
+
import { $ as deleteAfterProtectionFlipWithFinalSnapshot, B as resolveExplicitPhysicalId, H as assertRegionMatch, I as normalizeAwsTagsToCfn, It as maskerOrIdentity, J as observeThenDisableProtection, K as deleteWithProtectionCompensation, Kt as markAuxiliaryFailure, Lt as withDerivedNameMasks, Mt as createMaskedLogSinks, Q as PROTECTION_FLIP_RETRY_WAIT_MS, V as RESOURCE_NOT_FOUND, W as markNotGone, Y as rdsFamilyProtectionSite, a as withRemovalDefaults, f as retractCreatedResource, gt as protectedReplacementAdvice, ht as pasteableAwsCommand, it as ProtectionFlipRegistry, j as withoutServerErrorRetries, nt as isTerminalDbWaitStatus, ot as protectionFlipKey, qt as markCreatedBeforeFailure, t as clearOnUpdateRemoval, u as reportCreatedResource } from "./update-removal-DLbbpOoJ.js";
|
|
4
|
+
import { u as ambientRegion } from "./aws-client-defaults-BayGUTJ4.js";
|
|
5
|
+
import { Ac as dbInstanceEngineChangeIsInPlace, ca as tagPlanWarning, ea as definedAttributes, hi as refuseRestoreFromItself, ia as planTagDiff, jt as enclosingDeadlineRemainingMs, ka as slowCcOperationTimeoutMs, oa as refuseMalformedDesiredTags, ql as acceptedCreateOnlyDropsOf, ta as stringifyIfAssigned, ua as markDeleteStarted, xl as dynamicReferenceTokens } from "./deploy-engine-B9WzTRxL.js";
|
|
6
|
+
import { a as associatedRoleList, c as canonicalAssociatedRoles, i as associatedRoleKey, l as isRoleCallNotAvailableRefusal, n as modifyDbInstanceWhenAvailable, o as associatedRolesNamed, r as associatedRoleArns, s as associatedRolesReadback, t as isModifyNotAvailableRefusal, u as planAssociatedRoleChanges } from "./db-instance-modify-retry-vrjXpAjl.js";
|
|
7
|
+
import { a as refuseMalformedReplicaSource, c as replicaEngine, d as replicaSourceChange, f as replicaSourceOf, l as replicaModifyAfterCreateInput, m as withPreviousReplicaSource, n as isLiveReadReplica, o as refuseUnknownSourceRegion, p as sameReplicaSource, r as ownScopeOf, s as replicaCreateInput, t as describeReplicaSource, u as replicaNeedsModifyAfterCreate } from "./read-replica-BA5570ms.js";
|
|
8
8
|
import { DescribeSecurityGroupsCommand, EC2Client } from "@aws-sdk/client-ec2";
|
|
9
9
|
import { isDeepStrictEqual } from "node:util";
|
|
10
10
|
import { AddRoleToDBClusterCommand, AddRoleToDBInstanceCommand, AddTagsToResourceCommand, CreateDBClusterCommand, CreateDBInstanceCommand, CreateDBInstanceReadReplicaCommand, CreateDBSubnetGroupCommand, DeleteDBClusterCommand, DeleteDBInstanceCommand, DeleteDBSubnetGroupCommand, DescribeDBClusterAutomatedBackupsCommand, DescribeDBClusterSnapshotsCommand, DescribeDBClustersCommand, DescribeDBInstanceAutomatedBackupsCommand, DescribeDBInstancesCommand, DescribeDBSubnetGroupsCommand, DescribeGlobalClustersCommand, DisableHttpEndpointCommand, EnableHttpEndpointCommand, ListTagsForResourceCommand, ModifyDBClusterCommand, ModifyDBInstanceCommand, ModifyDBSubnetGroupCommand, PromoteReadReplicaCommand, RDSClient, RebootDBInstanceCommand, RemoveFromGlobalClusterCommand, RemoveRoleFromDBClusterCommand, RemoveRoleFromDBInstanceCommand, RemoveTagsFromResourceCommand, RestoreDBClusterFromSnapshotCommand, RestoreDBClusterToPointInTimeCommand, StartDBInstanceAutomatedBackupsReplicationCommand, StopDBInstanceAutomatedBackupsReplicationCommand } from "@aws-sdk/client-rds";
|
|
@@ -2222,6 +2222,222 @@ async function replicatedBackupRetention(automatedBackupsArn) {
|
|
|
2222
2222
|
}
|
|
2223
2223
|
}
|
|
2224
2224
|
|
|
2225
|
+
// src/provisioning/providers/rds/additional-storage-volumes.ts
|
|
2226
|
+
const NUMERIC_MEMBERS = [
|
|
2227
|
+
["AllocatedStorage", "AllocatedStorage"],
|
|
2228
|
+
["Iops", "IOPS"],
|
|
2229
|
+
["MaxAllocatedStorage", "MaxAllocatedStorage"],
|
|
2230
|
+
["StorageThroughput", "StorageThroughput"]
|
|
2231
|
+
];
|
|
2232
|
+
function wholeNumber(value) {
|
|
2233
|
+
if (typeof value === "number") return Number.isInteger(value) ? value : "malformed";
|
|
2234
|
+
if (typeof value === "string" && /^\d+$/.test(value.trim())) return Number(value.trim());
|
|
2235
|
+
return "malformed";
|
|
2236
|
+
}
|
|
2237
|
+
function additionalStorageVolumeList(value) {
|
|
2238
|
+
if (value == null) return void 0;
|
|
2239
|
+
if (!Array.isArray(value)) return "malformed";
|
|
2240
|
+
const out = [];
|
|
2241
|
+
const names = /* @__PURE__ */ new Set();
|
|
2242
|
+
for (const item of value) {
|
|
2243
|
+
if (item === null || typeof item !== "object" || Array.isArray(item)) return "malformed";
|
|
2244
|
+
const entry = item;
|
|
2245
|
+
const name = entry["VolumeName"];
|
|
2246
|
+
if (typeof name !== "string" || name === "" || names.has(name)) return "malformed";
|
|
2247
|
+
names.add(name);
|
|
2248
|
+
const volume = { VolumeName: name };
|
|
2249
|
+
for (const [cfn, sdk] of NUMERIC_MEMBERS) {
|
|
2250
|
+
if (entry[cfn] == null) continue;
|
|
2251
|
+
const parsed = wholeNumber(entry[cfn]);
|
|
2252
|
+
if (parsed === "malformed") return "malformed";
|
|
2253
|
+
volume[sdk] = parsed;
|
|
2254
|
+
}
|
|
2255
|
+
const storageType = entry["StorageType"];
|
|
2256
|
+
if (storageType != null) {
|
|
2257
|
+
if (typeof storageType !== "string") return "malformed";
|
|
2258
|
+
volume.StorageType = storageType;
|
|
2259
|
+
}
|
|
2260
|
+
out.push(volume);
|
|
2261
|
+
}
|
|
2262
|
+
return out;
|
|
2263
|
+
}
|
|
2264
|
+
function refusalText(resourceType, logicalId) {
|
|
2265
|
+
return `${resourceType} ${logicalId}: AdditionalStorageVolumes must be a list of { VolumeName, StorageType, AllocatedStorage, Iops, MaxAllocatedStorage, StorageThroughput } objects with distinct VolumeName values and whole-number sizes`;
|
|
2266
|
+
}
|
|
2267
|
+
function desiredAdditionalStorageVolumes(properties, resourceType, logicalId) {
|
|
2268
|
+
const volumes = additionalStorageVolumeList(properties["AdditionalStorageVolumes"]);
|
|
2269
|
+
if (volumes === "malformed") throw markNonRetryable(new ProvisioningError(refusalText(resourceType, logicalId), resourceType, logicalId));
|
|
2270
|
+
return volumes;
|
|
2271
|
+
}
|
|
2272
|
+
function sendableVolumeLists(properties, previousProperties, resourceType, logicalId, physicalId, rollbackWarn) {
|
|
2273
|
+
const desiredRaw = properties["AdditionalStorageVolumes"];
|
|
2274
|
+
const previousRaw = previousProperties["AdditionalStorageVolumes"];
|
|
2275
|
+
if (isDeepStrictEqual(desiredRaw, previousRaw)) return void 0;
|
|
2276
|
+
const desired = additionalStorageVolumeList(desiredRaw);
|
|
2277
|
+
if (desired === "malformed") throw markNonRetryable(new ProvisioningError(refusalText(resourceType, logicalId), resourceType, logicalId, physicalId));
|
|
2278
|
+
const previous = additionalStorageVolumeList(previousRaw);
|
|
2279
|
+
if (previous !== "malformed" && previous !== void 0 && desired !== void 0) {
|
|
2280
|
+
const before = new Set(previous.map((volume) => volume.VolumeName));
|
|
2281
|
+
const after = new Set(desired.map((volume) => volume.VolumeName));
|
|
2282
|
+
for (const name of after) {
|
|
2283
|
+
if (name === void 0 || before.has(name)) continue;
|
|
2284
|
+
const renamed = [...before].find((old) => old !== void 0 && !after.has(old) && old.toLowerCase() === name.toLowerCase());
|
|
2285
|
+
if (renamed !== void 0 && rollbackWarn !== void 0) {
|
|
2286
|
+
rollbackWarn(safeMsg`${logicalId}: the rollback leaves AdditionalStorageVolumes as it is, because restoring it would rename volume ${renamed} to ${name} by case only`);
|
|
2287
|
+
return;
|
|
2288
|
+
}
|
|
2289
|
+
if (renamed !== void 0) throw markNonRetryable(new ProvisioningError(safeMsg`${resourceType} ${logicalId}: AdditionalStorageVolumes renames volume ${renamed} to ${name} by case only, which would delete ${renamed} while RDS may read both names as one volume; keep the recorded spelling`, resourceType, logicalId, physicalId));
|
|
2290
|
+
}
|
|
2291
|
+
}
|
|
2292
|
+
return {
|
|
2293
|
+
desired,
|
|
2294
|
+
previous
|
|
2295
|
+
};
|
|
2296
|
+
}
|
|
2297
|
+
function declaredMemberChanged(volume, old) {
|
|
2298
|
+
return Object.keys(volume).some((key) => {
|
|
2299
|
+
const value = volume[key];
|
|
2300
|
+
if (value === void 0) return false;
|
|
2301
|
+
if (key === "StorageType" && typeof old.StorageType === "string") return String(value).toLowerCase() !== old.StorageType.toLowerCase();
|
|
2302
|
+
return value !== old[key];
|
|
2303
|
+
});
|
|
2304
|
+
}
|
|
2305
|
+
async function additionalStorageVolumeChanges(properties, previousProperties, readLive, source, resourceType, logicalId, physicalId, warn) {
|
|
2306
|
+
const lists = sendableVolumeLists(properties, previousProperties, resourceType, logicalId, physicalId, source.rollback ? warn : void 0);
|
|
2307
|
+
if (lists === void 0) return void 0;
|
|
2308
|
+
const { desired } = lists;
|
|
2309
|
+
let liveRead;
|
|
2310
|
+
const liveVolumes = async () => (await (liveRead ??= readLive()))?.AdditionalStorageVolumes ?? [];
|
|
2311
|
+
const named = new Set((desired ?? []).map((volume) => volume.VolumeName));
|
|
2312
|
+
let previous = lists.previous;
|
|
2313
|
+
const deletes = !source.fromReadback;
|
|
2314
|
+
if (previous === "malformed") {
|
|
2315
|
+
const live = await liveVolumes();
|
|
2316
|
+
const unnamed = live.map((volume) => volume.VolumeName).filter((name) => name !== void 0 && !named.has(name));
|
|
2317
|
+
if (unnamed.length > 0) warn(safeMsg`${logicalId}: the recorded AdditionalStorageVolumes is unreadable, so additional storage volume(s) ${unnamed.join(", ")} the template does not declare are left in place rather than deleted`);
|
|
2318
|
+
previous = live.filter((volume) => volume.VolumeName !== void 0 && named.has(volume.VolumeName)).map((volume) => liveVolume(volume));
|
|
2319
|
+
}
|
|
2320
|
+
const before = new Map((previous ?? []).map((volume) => [volume.VolumeName, volume]));
|
|
2321
|
+
const out = [];
|
|
2322
|
+
for (const declared of desired ?? []) {
|
|
2323
|
+
const old = before.get(declared.VolumeName);
|
|
2324
|
+
if (old === void 0) {
|
|
2325
|
+
out.push(declared);
|
|
2326
|
+
continue;
|
|
2327
|
+
}
|
|
2328
|
+
let volume = declared;
|
|
2329
|
+
if (source.rollback && volume.AllocatedStorage !== void 0 && old.AllocatedStorage !== void 0 && old.AllocatedStorage > volume.AllocatedStorage) volume = {
|
|
2330
|
+
...volume,
|
|
2331
|
+
AllocatedStorage: old.AllocatedStorage
|
|
2332
|
+
};
|
|
2333
|
+
if (!declaredMemberChanged(volume, old)) continue;
|
|
2334
|
+
if (volume.AllocatedStorage !== void 0 && (source.rollback || volume.AllocatedStorage === old.AllocatedStorage)) {
|
|
2335
|
+
const live = (await liveVolumes()).find((item) => item.VolumeName === volume.VolumeName);
|
|
2336
|
+
if (live?.AllocatedStorage !== void 0 && live.AllocatedStorage > volume.AllocatedStorage) volume = {
|
|
2337
|
+
...volume,
|
|
2338
|
+
AllocatedStorage: live.AllocatedStorage
|
|
2339
|
+
};
|
|
2340
|
+
}
|
|
2341
|
+
out.push(volume);
|
|
2342
|
+
}
|
|
2343
|
+
const removed = (previous ?? []).filter((volume) => !named.has(volume.VolumeName));
|
|
2344
|
+
if (deletes) {
|
|
2345
|
+
const listed = source.rollback ? new Set((await liveVolumes()).map((volume) => volume.VolumeName)) : void 0;
|
|
2346
|
+
for (const volume of removed) {
|
|
2347
|
+
if (listed !== void 0 && !listed.has(volume.VolumeName)) {
|
|
2348
|
+
warn(safeMsg`${logicalId}: the rollback sends no delete for additional storage volume ${volume.VolumeName ?? ""}, which the instance does not list`);
|
|
2349
|
+
continue;
|
|
2350
|
+
}
|
|
2351
|
+
out.push({
|
|
2352
|
+
VolumeName: volume.VolumeName,
|
|
2353
|
+
SetForDelete: true
|
|
2354
|
+
});
|
|
2355
|
+
}
|
|
2356
|
+
} else if (source.fromReadback && removed.length > 0) warn(safeMsg`${logicalId}: drift --revert leaves additional storage volume(s) ${removed.map((volume) => volume.VolumeName).join(", ")} in place: they are not in the recorded configuration, and deleting one discards its data. Delete it with ModifyDBInstance (SetForDelete) if that is intended`);
|
|
2357
|
+
return out.length > 0 ? out : void 0;
|
|
2358
|
+
}
|
|
2359
|
+
function liveVolume(volume) {
|
|
2360
|
+
const out = { VolumeName: volume.VolumeName };
|
|
2361
|
+
for (const [, sdk] of NUMERIC_MEMBERS) if (volume[sdk] !== void 0) out[sdk] = volume[sdk];
|
|
2362
|
+
if (volume.StorageType !== void 0) out.StorageType = volume.StorageType;
|
|
2363
|
+
return out;
|
|
2364
|
+
}
|
|
2365
|
+
function readAdditionalStorageVolumes(instance) {
|
|
2366
|
+
const live = instance.AdditionalStorageVolumes;
|
|
2367
|
+
if (live === void 0 || live.length === 0) return void 0;
|
|
2368
|
+
return live.map((volume) => {
|
|
2369
|
+
const out = {};
|
|
2370
|
+
if (volume.VolumeName !== void 0) out["VolumeName"] = volume.VolumeName;
|
|
2371
|
+
if (volume.StorageType !== void 0) out["StorageType"] = volume.StorageType;
|
|
2372
|
+
for (const [cfn, sdk] of NUMERIC_MEMBERS) if (volume[sdk] !== void 0) out[cfn] = volume[sdk];
|
|
2373
|
+
return out;
|
|
2374
|
+
});
|
|
2375
|
+
}
|
|
2376
|
+
const QUIET_READS = 3;
|
|
2377
|
+
function changeUnderWay(instance) {
|
|
2378
|
+
return instance.DBInstanceStatus !== "available" || (instance.PendingModifiedValues?.AdditionalStorageVolumes ?? []).length > 0;
|
|
2379
|
+
}
|
|
2380
|
+
function additionalStorageVolumesSettled(sent, modified) {
|
|
2381
|
+
let changeSeen = modified !== void 0 && changeUnderWay(modified);
|
|
2382
|
+
let quietReads = 0;
|
|
2383
|
+
return (instance) => {
|
|
2384
|
+
if (changeUnderWay(instance)) {
|
|
2385
|
+
changeSeen = true;
|
|
2386
|
+
return false;
|
|
2387
|
+
}
|
|
2388
|
+
const live = instance.AdditionalStorageVolumes ?? [];
|
|
2389
|
+
if (!sent.every((volume) => {
|
|
2390
|
+
const match = live.find((item) => item.VolumeName === volume.VolumeName);
|
|
2391
|
+
if (volume.SetForDelete === true) return match === void 0;
|
|
2392
|
+
if (match === void 0) return false;
|
|
2393
|
+
if (volume.AllocatedStorage !== void 0 && (match.AllocatedStorage === void 0 || match.AllocatedStorage < volume.AllocatedStorage)) return false;
|
|
2394
|
+
return volume.StorageType === void 0 || match.StorageType?.toLowerCase() === volume.StorageType.toLowerCase();
|
|
2395
|
+
})) return false;
|
|
2396
|
+
if (changeSeen) return true;
|
|
2397
|
+
quietReads += 1;
|
|
2398
|
+
return quietReads >= QUIET_READS;
|
|
2399
|
+
};
|
|
2400
|
+
}
|
|
2401
|
+
function canonicalAdditionalStorageVolumes(value) {
|
|
2402
|
+
if (!Array.isArray(value)) return value;
|
|
2403
|
+
return value.map((item) => {
|
|
2404
|
+
if (item === null || typeof item !== "object" || Array.isArray(item)) return item;
|
|
2405
|
+
const entry = { ...item };
|
|
2406
|
+
for (const [cfn] of NUMERIC_MEMBERS) {
|
|
2407
|
+
const member = entry[cfn];
|
|
2408
|
+
if (typeof member === "string" && /^\d+$/.test(member.trim())) entry[cfn] = Number(member.trim());
|
|
2409
|
+
}
|
|
2410
|
+
if (typeof entry["StorageType"] === "string") entry["StorageType"] = entry["StorageType"].toLowerCase();
|
|
2411
|
+
return entry;
|
|
2412
|
+
});
|
|
2413
|
+
}
|
|
2414
|
+
function withDeclaredVolumeMembers(baseline, aws) {
|
|
2415
|
+
const declared = baseline["AdditionalStorageVolumes"];
|
|
2416
|
+
const live = aws["AdditionalStorageVolumes"];
|
|
2417
|
+
if (!Array.isArray(declared) || !Array.isArray(live)) return aws;
|
|
2418
|
+
const members = /* @__PURE__ */ new Map();
|
|
2419
|
+
for (const item of declared) {
|
|
2420
|
+
if (item === null || typeof item !== "object" || Array.isArray(item)) return aws;
|
|
2421
|
+
const entry = item;
|
|
2422
|
+
members.set(entry["VolumeName"], Object.keys(entry).filter((key) => entry[key] !== void 0));
|
|
2423
|
+
}
|
|
2424
|
+
let changed = false;
|
|
2425
|
+
const narrowed = live.map((item) => {
|
|
2426
|
+
if (item === null || typeof item !== "object" || Array.isArray(item)) return item;
|
|
2427
|
+
const entry = item;
|
|
2428
|
+
const keys = members.get(entry["VolumeName"]);
|
|
2429
|
+
if (keys === void 0) return item;
|
|
2430
|
+
const out = {};
|
|
2431
|
+
for (const key of keys) if (key in entry) out[key] = entry[key];
|
|
2432
|
+
if (Object.keys(out).length !== Object.keys(entry).length) changed = true;
|
|
2433
|
+
return out;
|
|
2434
|
+
});
|
|
2435
|
+
return changed ? {
|
|
2436
|
+
...aws,
|
|
2437
|
+
AdditionalStorageVolumes: narrowed
|
|
2438
|
+
} : aws;
|
|
2439
|
+
}
|
|
2440
|
+
|
|
2225
2441
|
// src/provisioning/providers/rds/instance-create.ts
|
|
2226
2442
|
async function createDBInstance(logicalId, resourceType, properties, mask, replaying = false) {
|
|
2227
2443
|
this.logger.debug(`Creating DBInstance ${logicalId}`);
|
|
@@ -2229,6 +2445,7 @@ async function createDBInstance(logicalId, resourceType, properties, mask, repla
|
|
|
2229
2445
|
const roles = this.desiredAssociatedRoles(properties, resourceType, logicalId, void 0, replaying);
|
|
2230
2446
|
const logExports = desiredLogExports(properties, resourceType, logicalId);
|
|
2231
2447
|
const processor = desiredProcessorFeatures(properties, resourceType, logicalId);
|
|
2448
|
+
const volumes = desiredAdditionalStorageVolumes(properties, resourceType, logicalId);
|
|
2232
2449
|
const replication = backupReplicationPlan(properties, {}, resourceType, logicalId, void 0, replaying, (message) => this.logger.warn(message));
|
|
2233
2450
|
refuseMalformedReplicaSource(properties, resourceType, logicalId);
|
|
2234
2451
|
refuseUnknownSourceRegion(properties, resourceType, logicalId, replaying, (message) => this.logger.warn(message));
|
|
@@ -2291,6 +2508,7 @@ async function createDBInstance(logicalId, resourceType, properties, mask, repla
|
|
|
2291
2508
|
...properties["NcharCharacterSetName"] != null && { NcharCharacterSetName: properties["NcharCharacterSetName"] },
|
|
2292
2509
|
...properties["Timezone"] != null && { Timezone: properties["Timezone"] },
|
|
2293
2510
|
...processor.features !== void 0 && { ProcessorFeatures: processor.features },
|
|
2511
|
+
...volumes !== void 0 && { AdditionalStorageVolumes: volumes },
|
|
2294
2512
|
...tags.length > 0 && { Tags: tags }
|
|
2295
2513
|
});
|
|
2296
2514
|
const replicaEngineName = replicaSource === void 0 ? void 0 : await replicaEngine.call(this, properties, replicaSource);
|
|
@@ -2304,7 +2522,8 @@ async function createDBInstance(logicalId, resourceType, properties, mask, repla
|
|
|
2304
2522
|
logExports
|
|
2305
2523
|
}),
|
|
2306
2524
|
...processor.features !== void 0 && { ProcessorFeatures: processor.features },
|
|
2307
|
-
...processor.useDefault !== void 0 && { UseDefaultProcessorFeatures: processor.useDefault }
|
|
2525
|
+
...processor.useDefault !== void 0 && { UseDefaultProcessorFeatures: processor.useDefault },
|
|
2526
|
+
...volumes !== void 0 && { AdditionalStorageVolumes: volumes }
|
|
2308
2527
|
}));
|
|
2309
2528
|
instanceCreated = true;
|
|
2310
2529
|
createdResourceId = response.DBInstance?.DbiResourceId;
|
|
@@ -2377,6 +2596,7 @@ async function updateDBInstance(logicalId, physicalId, resourceType, properties,
|
|
|
2377
2596
|
const roles = this.desiredAssociatedRoles(properties, resourceType, logicalId, physicalId, false);
|
|
2378
2597
|
const logExportConfig = logExportsDelta(desiredLogExports(properties, resourceType, logicalId, physicalId), previousProperties["EnableCloudwatchLogsExports"]);
|
|
2379
2598
|
const processorMembers = instanceProcessorFeatureMembers(properties, previousProperties, resourceType, logicalId, physicalId);
|
|
2599
|
+
sendableVolumeLists(properties, previousProperties, resourceType, logicalId, physicalId, context?.replayingState === true ? () => {} : void 0);
|
|
2380
2600
|
const replication = backupReplicationPlan(properties, previousProperties, resourceType, logicalId, physicalId, context?.replayingState === true || context?.desiredFromAwsReadback === true, (message) => this.logger.warn(message));
|
|
2381
2601
|
const vpcSgIds = await this.securityGroupsToSend("DBInstance", logicalId, physicalId, resourceType, properties, previousProperties, context);
|
|
2382
2602
|
const engineLifecycleSupport = await this.engineLifecycleSupportToSend("DB instance", logicalId, physicalId, resourceType, properties, previousProperties, context);
|
|
@@ -2391,6 +2611,10 @@ async function updateDBInstance(logicalId, physicalId, resourceType, properties,
|
|
|
2391
2611
|
refuseMalformedReplicaSource(properties, resourceType, logicalId, physicalId);
|
|
2392
2612
|
const sourceChange = replicaSourceChange(properties, previousProperties);
|
|
2393
2613
|
try {
|
|
2614
|
+
const volumeChanges = await additionalStorageVolumeChanges(properties, previousProperties, () => this.describeDBInstance(physicalId), {
|
|
2615
|
+
rollback: context?.replayingState === true,
|
|
2616
|
+
fromReadback: context?.desiredFromAwsReadback === true
|
|
2617
|
+
}, resourceType, logicalId, physicalId, (message) => this.logger.warn(message));
|
|
2394
2618
|
const { mask: sourceMask } = withDerivedNameMasks(this.logger, createMaskedLogSinks(this.logger, context?.maskSecrets), [[previousProperties["DBInstanceIdentifier"], physicalId]]);
|
|
2395
2619
|
let sourceKept = sourceChange !== "immutable";
|
|
2396
2620
|
let liveSourceRead = "read";
|
|
@@ -2487,6 +2711,7 @@ async function updateDBInstance(logicalId, physicalId, resourceType, properties,
|
|
|
2487
2711
|
EnableIAMDatabaseAuthentication: properties["EnableIAMDatabaseAuthentication"],
|
|
2488
2712
|
...logExportConfig !== void 0 && { CloudwatchLogsExportConfiguration: logExportConfig },
|
|
2489
2713
|
...processorMembers,
|
|
2714
|
+
...volumeChanges !== void 0 && { AdditionalStorageVolumes: volumeChanges },
|
|
2490
2715
|
...engineLifecycleSupport !== void 0 && { EngineLifecycleSupport: engineLifecycleSupport },
|
|
2491
2716
|
...authenticationType !== void 0 && { MasterUserAuthenticationType: authenticationType }
|
|
2492
2717
|
}));
|
|
@@ -2503,6 +2728,7 @@ async function updateDBInstance(logicalId, physicalId, resourceType, properties,
|
|
|
2503
2728
|
this.logger.debug(`Successfully updated DBInstance ${logicalId}`);
|
|
2504
2729
|
if (process.env["CDKD_NO_WAIT"] !== "true" && logExportConfig !== void 0) await this.waitForInstanceState(logicalId, physicalId, (instance) => logExportsApplied(logExportConfig, instance.EnabledCloudwatchLogsExports, instance.PendingModifiedValues?.PendingCloudwatchLogsExports), "CloudWatch Logs exports change");
|
|
2505
2730
|
if (process.env["CDKD_NO_WAIT"] !== "true" && (processorMembers.ProcessorFeatures !== void 0 || processorMembers.UseDefaultProcessorFeatures !== void 0)) await this.waitForInstanceState(logicalId, physicalId, processorFeaturesSettled(processorMembers.ProcessorFeatures, modified), "processor features change");
|
|
2731
|
+
if (process.env["CDKD_NO_WAIT"] !== "true" && volumeChanges !== void 0) await this.waitForInstanceState(logicalId, physicalId, additionalStorageVolumesSettled(volumeChanges, modified), "additional storage volumes change");
|
|
2506
2732
|
let described = await this.describeDBInstance(physicalId);
|
|
2507
2733
|
const sentGroup = backfillMembers.DBParameterGroupName;
|
|
2508
2734
|
if (sentGroup !== void 0 || instanceParameterGroupPendingReboot(described) || instanceParameterGroupApplying(described)) described = await this.rebootForPendingParameterGroup(logicalId, physicalId, sentGroup, String(properties["CertificateRotationRestart"]) === "true");
|
|
@@ -2879,7 +3105,8 @@ function getDriftUnorderedPaths(resourceType) {
|
|
|
2879
3105
|
if (resourceType === "AWS::RDS::DBInstance") return [
|
|
2880
3106
|
"EnableCloudwatchLogsExports",
|
|
2881
3107
|
"AssociatedRoles",
|
|
2882
|
-
"ProcessorFeatures"
|
|
3108
|
+
"ProcessorFeatures",
|
|
3109
|
+
"AdditionalStorageVolumes"
|
|
2883
3110
|
];
|
|
2884
3111
|
return resourceType === "AWS::RDS::DBCluster" ? ["EnableCloudwatchLogsExports", "AssociatedRoles"] : [];
|
|
2885
3112
|
}
|
|
@@ -2894,7 +3121,9 @@ function getDriftUnknownPaths(resourceType, properties) {
|
|
|
2894
3121
|
];
|
|
2895
3122
|
const retention = properties?.["AutomaticBackupReplicationRetentionPeriod"];
|
|
2896
3123
|
const declared = properties?.["ProcessorFeatures"];
|
|
3124
|
+
const volumes = properties?.["AdditionalStorageVolumes"];
|
|
2897
3125
|
return [
|
|
3126
|
+
...volumes == null || Array.isArray(volumes) && volumes.length === 0 ? ["AdditionalStorageVolumes"] : [],
|
|
2898
3127
|
...instanceUnknown,
|
|
2899
3128
|
...declared == null || Array.isArray(declared) && declared.length === 0 ? ["ProcessorFeatures"] : [],
|
|
2900
3129
|
...retention == null || retention === "" ? ["AutomaticBackupReplicationRetentionPeriod"] : []
|
|
@@ -2927,7 +3156,10 @@ function canonicalizeDriftProperties(resourceType, properties) {
|
|
|
2927
3156
|
out[key] = value;
|
|
2928
3157
|
};
|
|
2929
3158
|
if (Array.isArray(properties["AssociatedRoles"])) set("AssociatedRoles", canonicalAssociatedRoles(properties["AssociatedRoles"]));
|
|
2930
|
-
if (resourceType !== "AWS::RDS::DBCluster")
|
|
3159
|
+
if (resourceType !== "AWS::RDS::DBCluster") {
|
|
3160
|
+
if (Array.isArray(properties["AdditionalStorageVolumes"])) set("AdditionalStorageVolumes", canonicalAdditionalStorageVolumes(properties["AdditionalStorageVolumes"]));
|
|
3161
|
+
return out ?? properties;
|
|
3162
|
+
}
|
|
2931
3163
|
for (const key of CLUSTER_BOOLEAN_SCALARS) {
|
|
2932
3164
|
const value = properties[key];
|
|
2933
3165
|
if (value === "true" || value === "false") set(key, value === "true");
|
|
@@ -2947,7 +3179,7 @@ function canonicalizeDriftProperties(resourceType, properties) {
|
|
|
2947
3179
|
return out ?? properties;
|
|
2948
3180
|
}
|
|
2949
3181
|
async function canonicalizeDriftPair(resourceType, baseline, aws) {
|
|
2950
|
-
if (resourceType === "AWS::RDS::DBInstance") aws = withDeclaredProcessorFeatures(baseline, aws);
|
|
3182
|
+
if (resourceType === "AWS::RDS::DBInstance") aws = withDeclaredVolumeMembers(baseline, withDeclaredProcessorFeatures(baseline, aws));
|
|
2951
3183
|
const recorded = baseline["SourceDBInstanceIdentifier"];
|
|
2952
3184
|
const live = aws["SourceDBInstanceIdentifier"];
|
|
2953
3185
|
if (resourceType !== "AWS::RDS::DBInstance" || typeof recorded !== "string" || typeof live !== "string" || recorded === live) return {
|
|
@@ -3114,6 +3346,8 @@ async function readCurrentStateDBInstance(physicalId) {
|
|
|
3114
3346
|
Name: feature.Name,
|
|
3115
3347
|
Value: feature.Value
|
|
3116
3348
|
}));
|
|
3349
|
+
const volumes = readAdditionalStorageVolumes(inst);
|
|
3350
|
+
if (volumes !== void 0) result["AdditionalStorageVolumes"] = volumes;
|
|
3117
3351
|
const replicationArn = inst.DBInstanceAutomatedBackupsReplications?.[0]?.DBInstanceAutomatedBackupsArn;
|
|
3118
3352
|
const replicationRegion = replicationArn?.split(":")[3];
|
|
3119
3353
|
if (replicationArn !== void 0 && replicationRegion !== void 0 && replicationRegion !== "") {
|
|
@@ -3367,6 +3601,7 @@ var RDSProvider = class {
|
|
|
3367
3601
|
"SourceDBInstanceIdentifier",
|
|
3368
3602
|
"SourceRegion",
|
|
3369
3603
|
"ProcessorFeatures",
|
|
3604
|
+
"AdditionalStorageVolumes",
|
|
3370
3605
|
"UseDefaultProcessorFeatures",
|
|
3371
3606
|
"AutomaticBackupReplicationRegion",
|
|
3372
3607
|
"AutomaticBackupReplicationKmsKeyId",
|
|
@@ -3595,4 +3830,4 @@ var RDSProvider = class {
|
|
|
3595
3830
|
};
|
|
3596
3831
|
|
|
3597
3832
|
export { RDSProvider };
|
|
3598
|
-
//# sourceMappingURL=rds-provider-
|
|
3833
|
+
//# sourceMappingURL=rds-provider-CvaAoT1c.js.map
|