@cdkd/cli 0.341.0 → 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-BT_0gh9s.js → asg-provider-ApHZ6Mae.js} +5 -5
- package/dist/{asg-provider-BT_0gh9s.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-CCbm-DKl.js → db-instance-modify-retry-vrjXpAjl.js} +3 -3
- package/dist/{db-instance-modify-retry-CCbm-DKl.js.map → db-instance-modify-retry-vrjXpAjl.js.map} +1 -1
- package/dist/{deploy-engine-BZSAOzE6.js → deploy-engine-B9WzTRxL.js} +374 -48
- package/dist/deploy-engine-B9WzTRxL.js.map +1 -0
- package/dist/{ecr-uri-DmkrTyRF.js → ecr-uri-CLSVFzAB.js} +3 -3
- package/dist/{ecr-uri-DmkrTyRF.js.map → ecr-uri-CLSVFzAB.js.map} +1 -1
- package/dist/{iam-role-provider-CbUqsAAi.js → iam-role-provider-qyUDKsou.js} +5 -5
- package/dist/{iam-role-provider-CbUqsAAi.js.map → iam-role-provider-qyUDKsou.js.map} +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -4
- package/dist/{neptune-provider-DlQ-_thp.js → neptune-provider-CZNhWtyQ.js} +6 -6
- package/dist/{neptune-provider-DlQ-_thp.js.map → neptune-provider-CZNhWtyQ.js.map} +1 -1
- package/dist/{program-7VC8uSCL.js → program-CWnbFCjg.js} +384 -123
- package/dist/program-CWnbFCjg.js.map +1 -0
- package/dist/{provider-classes-0cQAzv7Y.js → provider-classes-9YIXh-it.js} +12 -12
- package/dist/{provider-classes-0cQAzv7Y.js.map → provider-classes-9YIXh-it.js.map} +1 -1
- package/dist/{rds-provider-CaaoK9Yu.js → rds-provider-CvaAoT1c.js} +261 -21
- package/dist/rds-provider-CvaAoT1c.js.map +1 -0
- package/dist/{read-replica-DyG0ZkQJ.js → read-replica-BA5570ms.js} +3 -3
- package/dist/{read-replica-DyG0ZkQJ.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-B7cmr9JA.js → version-LNRY1BhV.js} +2 -2
- package/dist/{version-B7cmr9JA.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-BZSAOzE6.js.map +0 -1
- package/dist/program-7VC8uSCL.js.map +0 -1
- package/dist/rds-provider-CaaoK9Yu.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";
|
|
@@ -913,8 +913,12 @@ const RESTORE_SOURCE_KEYS = [
|
|
|
913
913
|
"SourceDbClusterResourceId",
|
|
914
914
|
"SnapshotIdentifier"
|
|
915
915
|
];
|
|
916
|
-
function
|
|
916
|
+
function recordedCreateOnlyDropsOf(context) {
|
|
917
|
+
return acceptedCreateOnlyDropsOf({ acceptedCreateOnlyDrops: context?.recordedCreateOnlyDrops });
|
|
918
|
+
}
|
|
919
|
+
function isRestoredRecord(properties, acceptedDrops) {
|
|
917
920
|
return RESTORE_SOURCE_KEYS.some((key) => {
|
|
921
|
+
if (acceptedDrops.has(key)) return false;
|
|
918
922
|
const source = properties?.[key];
|
|
919
923
|
return typeof source === "string" && source !== "";
|
|
920
924
|
});
|
|
@@ -1035,9 +1039,9 @@ async function readRestoreSnapshot(snapshotIdentifier, resourceType, logicalId,
|
|
|
1035
1039
|
this.logger.warn(restoresFromIt ? safeMsg`DBCluster ${logicalId}: could not read the restore snapshot (${awsErrorName(error)}), so it is restored as a standard (not limitless) cluster, as in CloudFormation.` : safeMsg`DBCluster ${logicalId}: could not read the declared SnapshotIdentifier (${awsErrorName(error)}); the point-in-time restore goes ahead without it, as in CloudFormation.`);
|
|
1036
1040
|
return UNREAD_SNAPSHOT;
|
|
1037
1041
|
}
|
|
1038
|
-
if (!this.isNotFoundError(error, "DBClusterSnapshotNotFoundFault")) throw this.wrapCaughtError(mask, error, (text) => new ProvisioningError(`Failed to create DBCluster ${logicalId}: reading the restore snapshot failed, so nothing was changed: ${text}`, resourceType, logicalId, void 0, error instanceof Error ? error : void 0));
|
|
1042
|
+
if (!this.isNotFoundError(error, "DBClusterSnapshotNotFoundFault")) throw this.wrapCaughtError(mask, error, (text) => new ProvisioningError(`Failed to create DBCluster ${logicalId}: reading the ${restoresFromIt ? "restore snapshot" : "declared SnapshotIdentifier"} failed, so nothing was changed: ${text}`, resourceType, logicalId, void 0, error instanceof Error ? error : void 0));
|
|
1039
1043
|
}
|
|
1040
|
-
if (!found) throw markNonRetryable(new ProvisioningError(safeMsg`${resourceType} ${logicalId}: SnapshotIdentifier ${snapshotIdentifier} does not name a DB cluster snapshot this account can read, so there is nothing to restore; nothing was changed.`, resourceType, logicalId));
|
|
1044
|
+
if (!found) throw markNonRetryable(new ProvisioningError(restoresFromIt ? safeMsg`${resourceType} ${logicalId}: SnapshotIdentifier ${snapshotIdentifier} does not name a DB cluster snapshot this account can read, so there is nothing to restore; nothing was changed.` : safeMsg`${resourceType} ${logicalId}: SnapshotIdentifier ${snapshotIdentifier} does not name a DB cluster snapshot this account can read. The point-in-time restore does not use it, but CloudFormation reads a declared snapshot first and fails the create, so nothing was changed; remove SnapshotIdentifier or name a readable snapshot.`, resourceType, logicalId));
|
|
1041
1045
|
return {
|
|
1042
1046
|
limitless: isLimitlessEngineVersion(engineVersion),
|
|
1043
1047
|
storageEncrypted
|
|
@@ -1601,7 +1605,7 @@ async function updateDBCluster(logicalId, physicalId, resourceType, properties,
|
|
|
1601
1605
|
this.logger.warn(safeMsg`DBCluster ${logicalId}: AllocatedStorage stays at ${String(previous)} GiB rather than going back to ${String(desired)} GiB, because RDS cannot shrink storage`);
|
|
1602
1606
|
skippedKeys.push(["AllocatedStorage", usableClusterSize]);
|
|
1603
1607
|
});
|
|
1604
|
-
if (globalClusterPlan.kind === "detach" && !await restoredOutsideGlobalCluster.call(this, previousProperties, physicalId, globalClusterPlan.globalClusterId)) {
|
|
1608
|
+
if (globalClusterPlan.kind === "detach" && !await restoredOutsideGlobalCluster.call(this, previousProperties, physicalId, globalClusterPlan.globalClusterId, recordedCreateOnlyDropsOf(context))) {
|
|
1605
1609
|
if (await this.detachFromGlobalCluster(logicalId, physicalId, globalClusterPlan.globalClusterId, {
|
|
1606
1610
|
beforeDelete: false,
|
|
1607
1611
|
removeProtection: false
|
|
@@ -1705,7 +1709,7 @@ async function planGlobalClusterUpdate(physicalId, properties, previousPropertie
|
|
|
1705
1709
|
if (!stateBorne || desiredId === void 0) return { kind: "none" };
|
|
1706
1710
|
const live = await liveGlobalClusterMembership.call(this, physicalId, desiredId);
|
|
1707
1711
|
if (live.kind !== "answered" || live.member) return { kind: "none" };
|
|
1708
|
-
if (isRestoredRecord(previousProperties)) return { kind: "none" };
|
|
1712
|
+
if (isRestoredRecord(previousProperties, recordedCreateOnlyDropsOf(context))) return { kind: "none" };
|
|
1709
1713
|
this.logger.warn(mask(safeMsg`${logicalId} (${resourceType}): the cluster is no longer a member of global cluster ${desiredId}, so the record drops GlobalClusterIdentifier.`));
|
|
1710
1714
|
return { kind: "drop" };
|
|
1711
1715
|
}
|
|
@@ -1760,8 +1764,8 @@ async function liveGlobalClusterMembership(physicalId, desiredId) {
|
|
|
1760
1764
|
};
|
|
1761
1765
|
}
|
|
1762
1766
|
}
|
|
1763
|
-
async function restoredOutsideGlobalCluster(properties, physicalId, globalClusterId) {
|
|
1764
|
-
if (!isRestoredRecord(properties)) return false;
|
|
1767
|
+
async function restoredOutsideGlobalCluster(properties, physicalId, globalClusterId, acceptedDrops) {
|
|
1768
|
+
if (!isRestoredRecord(properties, acceptedDrops)) return false;
|
|
1765
1769
|
const live = await liveGlobalClusterMembership.call(this, physicalId, globalClusterId);
|
|
1766
1770
|
return live.kind === "answered" && !live.member;
|
|
1767
1771
|
}
|
|
@@ -1844,14 +1848,15 @@ async function deleteDBClusterOnce(logicalId, physicalId, resourceType, properti
|
|
|
1844
1848
|
} catch (disableError) {
|
|
1845
1849
|
if (!this.isNotFoundError(disableError, "DBClusterNotFoundFault")) this.logger.debug(maskerOrIdentity(context?.maskSecrets)(`Could not disable deletion protection for DBCluster ${logicalId}: ${describeAwsFailure(disableError).detail}`));
|
|
1846
1850
|
}
|
|
1847
|
-
const
|
|
1851
|
+
const acceptedDrops = recordedCreateOnlyDropsOf(context);
|
|
1852
|
+
const restored = isRestoredRecord(properties, acceptedDrops);
|
|
1848
1853
|
const globalClusterId = recordedGlobalClusterIdentifier(properties);
|
|
1849
|
-
if (globalClusterId !== void 0 && !await restoredOutsideGlobalCluster.call(this, properties, physicalId, globalClusterId)) detachedFrom = await this.detachFromGlobalCluster(logicalId, physicalId, globalClusterId, {
|
|
1854
|
+
if (globalClusterId !== void 0 && !await restoredOutsideGlobalCluster.call(this, properties, physicalId, globalClusterId, acceptedDrops)) detachedFrom = await this.detachFromGlobalCluster(logicalId, physicalId, globalClusterId, {
|
|
1850
1855
|
beforeDelete: true,
|
|
1851
1856
|
removeProtection: context?.removeProtection === true
|
|
1852
1857
|
}, progress, maskerOrIdentity(context?.maskSecrets)) ? globalClusterId : void 0;
|
|
1853
1858
|
const recordedWriterId = recordedExpressWriterId(context?.recordedAttributes);
|
|
1854
|
-
if (!(restored && recordedWriterId === void 0) && expressConfigurationFlag(properties?.["WithExpressConfiguration"]) === true) {
|
|
1859
|
+
if (!(restored && recordedWriterId === void 0) && !acceptedDrops.has("WithExpressConfiguration") && expressConfigurationFlag(properties?.["WithExpressConfiguration"]) === true) {
|
|
1855
1860
|
if (await deleteExpressWriter.call(this, logicalId, physicalId, await this.describeDBCluster(physicalId), recordedWriterId, flip.flippedOffByThisRun, maskerOrIdentity(context?.maskSecrets))) progress.stripped = true;
|
|
1856
1861
|
}
|
|
1857
1862
|
const finalSnapshotId = context?.finalSnapshotIdentifier;
|
|
@@ -2217,6 +2222,222 @@ async function replicatedBackupRetention(automatedBackupsArn) {
|
|
|
2217
2222
|
}
|
|
2218
2223
|
}
|
|
2219
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
|
+
|
|
2220
2441
|
// src/provisioning/providers/rds/instance-create.ts
|
|
2221
2442
|
async function createDBInstance(logicalId, resourceType, properties, mask, replaying = false) {
|
|
2222
2443
|
this.logger.debug(`Creating DBInstance ${logicalId}`);
|
|
@@ -2224,6 +2445,7 @@ async function createDBInstance(logicalId, resourceType, properties, mask, repla
|
|
|
2224
2445
|
const roles = this.desiredAssociatedRoles(properties, resourceType, logicalId, void 0, replaying);
|
|
2225
2446
|
const logExports = desiredLogExports(properties, resourceType, logicalId);
|
|
2226
2447
|
const processor = desiredProcessorFeatures(properties, resourceType, logicalId);
|
|
2448
|
+
const volumes = desiredAdditionalStorageVolumes(properties, resourceType, logicalId);
|
|
2227
2449
|
const replication = backupReplicationPlan(properties, {}, resourceType, logicalId, void 0, replaying, (message) => this.logger.warn(message));
|
|
2228
2450
|
refuseMalformedReplicaSource(properties, resourceType, logicalId);
|
|
2229
2451
|
refuseUnknownSourceRegion(properties, resourceType, logicalId, replaying, (message) => this.logger.warn(message));
|
|
@@ -2286,6 +2508,7 @@ async function createDBInstance(logicalId, resourceType, properties, mask, repla
|
|
|
2286
2508
|
...properties["NcharCharacterSetName"] != null && { NcharCharacterSetName: properties["NcharCharacterSetName"] },
|
|
2287
2509
|
...properties["Timezone"] != null && { Timezone: properties["Timezone"] },
|
|
2288
2510
|
...processor.features !== void 0 && { ProcessorFeatures: processor.features },
|
|
2511
|
+
...volumes !== void 0 && { AdditionalStorageVolumes: volumes },
|
|
2289
2512
|
...tags.length > 0 && { Tags: tags }
|
|
2290
2513
|
});
|
|
2291
2514
|
const replicaEngineName = replicaSource === void 0 ? void 0 : await replicaEngine.call(this, properties, replicaSource);
|
|
@@ -2299,7 +2522,8 @@ async function createDBInstance(logicalId, resourceType, properties, mask, repla
|
|
|
2299
2522
|
logExports
|
|
2300
2523
|
}),
|
|
2301
2524
|
...processor.features !== void 0 && { ProcessorFeatures: processor.features },
|
|
2302
|
-
...processor.useDefault !== void 0 && { UseDefaultProcessorFeatures: processor.useDefault }
|
|
2525
|
+
...processor.useDefault !== void 0 && { UseDefaultProcessorFeatures: processor.useDefault },
|
|
2526
|
+
...volumes !== void 0 && { AdditionalStorageVolumes: volumes }
|
|
2303
2527
|
}));
|
|
2304
2528
|
instanceCreated = true;
|
|
2305
2529
|
createdResourceId = response.DBInstance?.DbiResourceId;
|
|
@@ -2372,6 +2596,7 @@ async function updateDBInstance(logicalId, physicalId, resourceType, properties,
|
|
|
2372
2596
|
const roles = this.desiredAssociatedRoles(properties, resourceType, logicalId, physicalId, false);
|
|
2373
2597
|
const logExportConfig = logExportsDelta(desiredLogExports(properties, resourceType, logicalId, physicalId), previousProperties["EnableCloudwatchLogsExports"]);
|
|
2374
2598
|
const processorMembers = instanceProcessorFeatureMembers(properties, previousProperties, resourceType, logicalId, physicalId);
|
|
2599
|
+
sendableVolumeLists(properties, previousProperties, resourceType, logicalId, physicalId, context?.replayingState === true ? () => {} : void 0);
|
|
2375
2600
|
const replication = backupReplicationPlan(properties, previousProperties, resourceType, logicalId, physicalId, context?.replayingState === true || context?.desiredFromAwsReadback === true, (message) => this.logger.warn(message));
|
|
2376
2601
|
const vpcSgIds = await this.securityGroupsToSend("DBInstance", logicalId, physicalId, resourceType, properties, previousProperties, context);
|
|
2377
2602
|
const engineLifecycleSupport = await this.engineLifecycleSupportToSend("DB instance", logicalId, physicalId, resourceType, properties, previousProperties, context);
|
|
@@ -2386,6 +2611,10 @@ async function updateDBInstance(logicalId, physicalId, resourceType, properties,
|
|
|
2386
2611
|
refuseMalformedReplicaSource(properties, resourceType, logicalId, physicalId);
|
|
2387
2612
|
const sourceChange = replicaSourceChange(properties, previousProperties);
|
|
2388
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));
|
|
2389
2618
|
const { mask: sourceMask } = withDerivedNameMasks(this.logger, createMaskedLogSinks(this.logger, context?.maskSecrets), [[previousProperties["DBInstanceIdentifier"], physicalId]]);
|
|
2390
2619
|
let sourceKept = sourceChange !== "immutable";
|
|
2391
2620
|
let liveSourceRead = "read";
|
|
@@ -2482,6 +2711,7 @@ async function updateDBInstance(logicalId, physicalId, resourceType, properties,
|
|
|
2482
2711
|
EnableIAMDatabaseAuthentication: properties["EnableIAMDatabaseAuthentication"],
|
|
2483
2712
|
...logExportConfig !== void 0 && { CloudwatchLogsExportConfiguration: logExportConfig },
|
|
2484
2713
|
...processorMembers,
|
|
2714
|
+
...volumeChanges !== void 0 && { AdditionalStorageVolumes: volumeChanges },
|
|
2485
2715
|
...engineLifecycleSupport !== void 0 && { EngineLifecycleSupport: engineLifecycleSupport },
|
|
2486
2716
|
...authenticationType !== void 0 && { MasterUserAuthenticationType: authenticationType }
|
|
2487
2717
|
}));
|
|
@@ -2498,6 +2728,7 @@ async function updateDBInstance(logicalId, physicalId, resourceType, properties,
|
|
|
2498
2728
|
this.logger.debug(`Successfully updated DBInstance ${logicalId}`);
|
|
2499
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");
|
|
2500
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");
|
|
2501
2732
|
let described = await this.describeDBInstance(physicalId);
|
|
2502
2733
|
const sentGroup = backfillMembers.DBParameterGroupName;
|
|
2503
2734
|
if (sentGroup !== void 0 || instanceParameterGroupPendingReboot(described) || instanceParameterGroupApplying(described)) described = await this.rebootForPendingParameterGroup(logicalId, physicalId, sentGroup, String(properties["CertificateRotationRestart"]) === "true");
|
|
@@ -2874,7 +3105,8 @@ function getDriftUnorderedPaths(resourceType) {
|
|
|
2874
3105
|
if (resourceType === "AWS::RDS::DBInstance") return [
|
|
2875
3106
|
"EnableCloudwatchLogsExports",
|
|
2876
3107
|
"AssociatedRoles",
|
|
2877
|
-
"ProcessorFeatures"
|
|
3108
|
+
"ProcessorFeatures",
|
|
3109
|
+
"AdditionalStorageVolumes"
|
|
2878
3110
|
];
|
|
2879
3111
|
return resourceType === "AWS::RDS::DBCluster" ? ["EnableCloudwatchLogsExports", "AssociatedRoles"] : [];
|
|
2880
3112
|
}
|
|
@@ -2889,7 +3121,9 @@ function getDriftUnknownPaths(resourceType, properties) {
|
|
|
2889
3121
|
];
|
|
2890
3122
|
const retention = properties?.["AutomaticBackupReplicationRetentionPeriod"];
|
|
2891
3123
|
const declared = properties?.["ProcessorFeatures"];
|
|
3124
|
+
const volumes = properties?.["AdditionalStorageVolumes"];
|
|
2892
3125
|
return [
|
|
3126
|
+
...volumes == null || Array.isArray(volumes) && volumes.length === 0 ? ["AdditionalStorageVolumes"] : [],
|
|
2893
3127
|
...instanceUnknown,
|
|
2894
3128
|
...declared == null || Array.isArray(declared) && declared.length === 0 ? ["ProcessorFeatures"] : [],
|
|
2895
3129
|
...retention == null || retention === "" ? ["AutomaticBackupReplicationRetentionPeriod"] : []
|
|
@@ -2922,7 +3156,10 @@ function canonicalizeDriftProperties(resourceType, properties) {
|
|
|
2922
3156
|
out[key] = value;
|
|
2923
3157
|
};
|
|
2924
3158
|
if (Array.isArray(properties["AssociatedRoles"])) set("AssociatedRoles", canonicalAssociatedRoles(properties["AssociatedRoles"]));
|
|
2925
|
-
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
|
+
}
|
|
2926
3163
|
for (const key of CLUSTER_BOOLEAN_SCALARS) {
|
|
2927
3164
|
const value = properties[key];
|
|
2928
3165
|
if (value === "true" || value === "false") set(key, value === "true");
|
|
@@ -2942,7 +3179,7 @@ function canonicalizeDriftProperties(resourceType, properties) {
|
|
|
2942
3179
|
return out ?? properties;
|
|
2943
3180
|
}
|
|
2944
3181
|
async function canonicalizeDriftPair(resourceType, baseline, aws) {
|
|
2945
|
-
if (resourceType === "AWS::RDS::DBInstance") aws = withDeclaredProcessorFeatures(baseline, aws);
|
|
3182
|
+
if (resourceType === "AWS::RDS::DBInstance") aws = withDeclaredVolumeMembers(baseline, withDeclaredProcessorFeatures(baseline, aws));
|
|
2946
3183
|
const recorded = baseline["SourceDBInstanceIdentifier"];
|
|
2947
3184
|
const live = aws["SourceDBInstanceIdentifier"];
|
|
2948
3185
|
if (resourceType !== "AWS::RDS::DBInstance" || typeof recorded !== "string" || typeof live !== "string" || recorded === live) return {
|
|
@@ -3109,6 +3346,8 @@ async function readCurrentStateDBInstance(physicalId) {
|
|
|
3109
3346
|
Name: feature.Name,
|
|
3110
3347
|
Value: feature.Value
|
|
3111
3348
|
}));
|
|
3349
|
+
const volumes = readAdditionalStorageVolumes(inst);
|
|
3350
|
+
if (volumes !== void 0) result["AdditionalStorageVolumes"] = volumes;
|
|
3112
3351
|
const replicationArn = inst.DBInstanceAutomatedBackupsReplications?.[0]?.DBInstanceAutomatedBackupsArn;
|
|
3113
3352
|
const replicationRegion = replicationArn?.split(":")[3];
|
|
3114
3353
|
if (replicationArn !== void 0 && replicationRegion !== void 0 && replicationRegion !== "") {
|
|
@@ -3362,6 +3601,7 @@ var RDSProvider = class {
|
|
|
3362
3601
|
"SourceDBInstanceIdentifier",
|
|
3363
3602
|
"SourceRegion",
|
|
3364
3603
|
"ProcessorFeatures",
|
|
3604
|
+
"AdditionalStorageVolumes",
|
|
3365
3605
|
"UseDefaultProcessorFeatures",
|
|
3366
3606
|
"AutomaticBackupReplicationRegion",
|
|
3367
3607
|
"AutomaticBackupReplicationKmsKeyId",
|
|
@@ -3590,4 +3830,4 @@ var RDSProvider = class {
|
|
|
3590
3830
|
};
|
|
3591
3831
|
|
|
3592
3832
|
export { RDSProvider };
|
|
3593
|
-
//# sourceMappingURL=rds-provider-
|
|
3833
|
+
//# sourceMappingURL=rds-provider-CvaAoT1c.js.map
|