@cdkd/cli 0.339.0 → 0.341.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-D2df_dIB.js → ambient-client-defaults-CtGTOtn9.js} +2 -2
- package/dist/{ambient-client-defaults-D2df_dIB.js.map → ambient-client-defaults-CtGTOtn9.js.map} +1 -1
- package/dist/{asg-provider-BiLQ0XWy.js → asg-provider-BT_0gh9s.js} +5 -5
- package/dist/{asg-provider-BiLQ0XWy.js.map → asg-provider-BT_0gh9s.js.map} +1 -1
- package/dist/{aws-failure-text-FKztQiaJ.js → aws-failure-text-zxW2CTmF.js} +149 -9
- package/dist/aws-failure-text-zxW2CTmF.js.map +1 -0
- package/dist/cli.js +2 -2
- package/dist/{db-instance-modify-retry-DR1oW9Ln.js → db-instance-modify-retry-CCbm-DKl.js} +4 -4
- package/dist/{db-instance-modify-retry-DR1oW9Ln.js.map → db-instance-modify-retry-CCbm-DKl.js.map} +1 -1
- package/dist/{deploy-engine-BFlLAOb5.js → deploy-engine-BZSAOzE6.js} +4205 -4068
- package/dist/deploy-engine-BZSAOzE6.js.map +1 -0
- package/dist/{ecr-uri-DWcC0h82.js → ecr-uri-DmkrTyRF.js} +3 -3
- package/dist/{ecr-uri-DWcC0h82.js.map → ecr-uri-DmkrTyRF.js.map} +1 -1
- package/dist/{iam-role-provider-m_Kd7_uy.js → iam-role-provider-CbUqsAAi.js} +5 -5
- package/dist/{iam-role-provider-m_Kd7_uy.js.map → iam-role-provider-CbUqsAAi.js.map} +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -4
- package/dist/{neptune-provider-Du2C7Q5P.js → neptune-provider-DlQ-_thp.js} +6 -6
- package/dist/{neptune-provider-Du2C7Q5P.js.map → neptune-provider-DlQ-_thp.js.map} +1 -1
- package/dist/{program-B-C6eA7H.js → program-7VC8uSCL.js} +47 -55
- package/dist/program-7VC8uSCL.js.map +1 -0
- package/dist/{provider-classes-ZB2dhH_W.js → provider-classes-0cQAzv7Y.js} +283 -154
- package/dist/provider-classes-0cQAzv7Y.js.map +1 -0
- package/dist/{rds-provider-DzsTP_11.js → rds-provider-CaaoK9Yu.js} +448 -21
- package/dist/rds-provider-CaaoK9Yu.js.map +1 -0
- package/dist/{read-replica-DIfL8kl8.js → read-replica-DyG0ZkQJ.js} +3 -3
- package/dist/{read-replica-DIfL8kl8.js.map → read-replica-DyG0ZkQJ.js.map} +1 -1
- package/dist/{update-removal-DTvJXMeM.js → update-removal-CNj3wKPR.js} +3 -3
- package/dist/{update-removal-DTvJXMeM.js.map → update-removal-CNj3wKPR.js.map} +1 -1
- package/dist/{version-eQ4CwKON.js → version-B7cmr9JA.js} +2 -2
- package/dist/{version-eQ4CwKON.js.map → version-B7cmr9JA.js.map} +1 -1
- package/package.json +1 -1
- package/dist/aws-failure-text-FKztQiaJ.js.map +0 -1
- package/dist/deploy-engine-BFlLAOb5.js.map +0 -1
- package/dist/program-B-C6eA7H.js.map +0 -1
- package/dist/provider-classes-ZB2dhH_W.js.map +0 -1
- package/dist/rds-provider-DzsTP_11.js.map +0 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { D as relayedNameCollision, G as wrapMaskedAwsError, Q as CdkdError, U as markNonRetryable, W as markRedactedCause, g as ResourceUpdateNotSupportedError, rt as ProvisioningError, t as ambientClientDefaults } from "./ambient-client-defaults-
|
|
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-
|
|
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 { D as relayedNameCollision, G as wrapMaskedAwsError, Q as CdkdError, U as markNonRetryable, W as markRedactedCause, g as ResourceUpdateNotSupportedError, rt as ProvisioningError, t as ambientClientDefaults } from "./ambient-client-defaults-CtGTOtn9.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-CNj3wKPR.js";
|
|
4
4
|
import { c as ambientRegion } from "./aws-client-defaults-BLXFsfMa.js";
|
|
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-
|
|
5
|
+
import { Aa as slowCcOperationTimeoutMs, Sl as dynamicReferenceTokens, aa as planTagDiff, da as markDeleteStarted, gi as refuseRestoreFromItself, jc as dbInstanceEngineChangeIsInPlace, jt as enclosingDeadlineRemainingMs, la as tagPlanWarning, na as stringifyIfAssigned, sa as refuseMalformedDesiredTags, ta as definedAttributes } from "./deploy-engine-BZSAOzE6.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-CCbm-DKl.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-DyG0ZkQJ.js";
|
|
8
8
|
import { DescribeSecurityGroupsCommand, EC2Client } from "@aws-sdk/client-ec2";
|
|
9
9
|
import { isDeepStrictEqual } from "node:util";
|
|
10
|
-
import { AddRoleToDBClusterCommand, AddRoleToDBInstanceCommand, AddTagsToResourceCommand, CreateDBClusterCommand, CreateDBInstanceCommand, CreateDBInstanceReadReplicaCommand, CreateDBSubnetGroupCommand, DeleteDBClusterCommand, DeleteDBInstanceCommand, DeleteDBSubnetGroupCommand, DescribeDBClustersCommand, DescribeDBInstanceAutomatedBackupsCommand, DescribeDBInstancesCommand, DescribeDBSubnetGroupsCommand, DescribeGlobalClustersCommand, DisableHttpEndpointCommand, EnableHttpEndpointCommand, ListTagsForResourceCommand, ModifyDBClusterCommand, ModifyDBInstanceCommand, ModifyDBSubnetGroupCommand, PromoteReadReplicaCommand, RDSClient, RebootDBInstanceCommand, RemoveFromGlobalClusterCommand, RemoveRoleFromDBClusterCommand, RemoveRoleFromDBInstanceCommand, RemoveTagsFromResourceCommand, StartDBInstanceAutomatedBackupsReplicationCommand, StopDBInstanceAutomatedBackupsReplicationCommand } from "@aws-sdk/client-rds";
|
|
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";
|
|
11
11
|
|
|
12
12
|
// src/provisioning/providers/rds/shared.ts
|
|
13
13
|
const RDS_DELETE_WAIT_MS = Math.max(18e5, slowCcOperationTimeoutMs("AWS::RDS::DBCluster", "DELETE"), slowCcOperationTimeoutMs("AWS::RDS::DBInstance", "DELETE"));
|
|
@@ -834,6 +834,360 @@ async function deleteExpressWriter(logicalId, physicalId, cluster, recordedWrite
|
|
|
834
834
|
return true;
|
|
835
835
|
}
|
|
836
836
|
|
|
837
|
+
// src/provisioning/providers/rds/cluster-restore.ts
|
|
838
|
+
function restoreCallName(restore) {
|
|
839
|
+
if (restore === void 0) return "CreateDBCluster";
|
|
840
|
+
return restore.kind === "snapshot" ? "RestoreDBClusterFromSnapshot" : "RestoreDBClusterToPointInTime";
|
|
841
|
+
}
|
|
842
|
+
const ZONED_DATE_TIME = /^(\d{4})-(\d{2})-(\d{2})[Tt](\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{1,9}))?)?(?:[Zz]|([+-])(\d{2})(?::(\d{2})(?::(\d{2}))?)?)(?:\[[^\]]+\])?$/;
|
|
843
|
+
function parseZonedTimestamp(text) {
|
|
844
|
+
const match = ZONED_DATE_TIME.exec(text);
|
|
845
|
+
if (match === null) return void 0;
|
|
846
|
+
const n = (i) => match[i] === void 0 ? 0 : Number(match[i]);
|
|
847
|
+
const [year, month, day, hour, minute, second] = [
|
|
848
|
+
n(1),
|
|
849
|
+
n(2),
|
|
850
|
+
n(3),
|
|
851
|
+
n(4),
|
|
852
|
+
n(5),
|
|
853
|
+
n(6)
|
|
854
|
+
];
|
|
855
|
+
const [offsetHours, offsetMinutes, offsetSeconds] = [
|
|
856
|
+
n(9),
|
|
857
|
+
n(10),
|
|
858
|
+
n(11)
|
|
859
|
+
];
|
|
860
|
+
if (month < 1 || month > 12 || hour > 23 || minute > 59 || second > 59) return void 0;
|
|
861
|
+
if (offsetMinutes > 59 || offsetSeconds > 59) return void 0;
|
|
862
|
+
if (offsetHours * 3600 + offsetMinutes * 60 + offsetSeconds > 64800) return void 0;
|
|
863
|
+
if (day < 1 || new Date(Date.UTC(year, month - 1, day)).getUTCDate() !== day) return void 0;
|
|
864
|
+
const millis = Number((match[7] ?? "").padEnd(3, "0").slice(0, 3));
|
|
865
|
+
const offsetMs = (match[8] === "-" ? -1 : 1) * (offsetHours * 3600 + offsetMinutes * 60 + offsetSeconds) * 1e3;
|
|
866
|
+
const date = new Date(Date.UTC(year, month - 1, day, hour, minute, second, millis) - offsetMs);
|
|
867
|
+
return Number.isNaN(date.getTime()) ? void 0 : date;
|
|
868
|
+
}
|
|
869
|
+
function readClusterRestore(properties, resourceType, logicalId) {
|
|
870
|
+
const refuse = (reason) => {
|
|
871
|
+
throw markNonRetryable(new ProvisioningError(safeMsg`${resourceType} ${logicalId}: ${reason}, as CloudFormation requires; nothing was changed.`, resourceType, logicalId));
|
|
872
|
+
};
|
|
873
|
+
const declaredTime = properties["RestoreToTime"];
|
|
874
|
+
let restoreToTime;
|
|
875
|
+
if (declaredTime != null && !(typeof declaredTime === "string" && declaredTime.trim() === "")) {
|
|
876
|
+
restoreToTime = typeof declaredTime === "string" ? parseZonedTimestamp(declaredTime) : void 0;
|
|
877
|
+
if (restoreToTime === void 0) return refuse("RestoreToTime must be an ISO 8601 timestamp with a time zone, such as 2026-01-01T00:00:00Z");
|
|
878
|
+
}
|
|
879
|
+
const declaredLatest = properties["UseLatestRestorableTime"];
|
|
880
|
+
const useLatestRestorableTime = declaredLatest == null ? void 0 : coerceCfnBoolean(declaredLatest);
|
|
881
|
+
if (declaredLatest != null && useLatestRestorableTime === void 0) return refuse("UseLatestRestorableTime must be true or false");
|
|
882
|
+
const stringKey = (key) => {
|
|
883
|
+
const value = properties[key];
|
|
884
|
+
if (value == null) return void 0;
|
|
885
|
+
if (typeof value !== "string") return refuse(`${key} must be a string`);
|
|
886
|
+
return value === "" ? void 0 : value;
|
|
887
|
+
};
|
|
888
|
+
const restoreType = stringKey("RestoreType");
|
|
889
|
+
const source = stringKey("SourceDBClusterIdentifier");
|
|
890
|
+
const sourceResourceId = stringKey("SourceDbClusterResourceId");
|
|
891
|
+
const snapshotIdentifier = stringKey("SnapshotIdentifier");
|
|
892
|
+
if (source !== void 0 && sourceResourceId !== void 0) return refuse("set either SourceDBClusterIdentifier or SourceDbClusterResourceId, not both");
|
|
893
|
+
if (source === void 0 && sourceResourceId === void 0) return snapshotIdentifier === void 0 ? void 0 : {
|
|
894
|
+
kind: "snapshot",
|
|
895
|
+
snapshotIdentifier
|
|
896
|
+
};
|
|
897
|
+
return {
|
|
898
|
+
kind: "point-in-time",
|
|
899
|
+
source: source !== void 0 ? {
|
|
900
|
+
by: "identifier",
|
|
901
|
+
value: source
|
|
902
|
+
} : {
|
|
903
|
+
by: "resource-id",
|
|
904
|
+
value: sourceResourceId
|
|
905
|
+
},
|
|
906
|
+
restoreToTime: useLatestRestorableTime === true ? void 0 : restoreToTime,
|
|
907
|
+
useLatestRestorableTime,
|
|
908
|
+
restoreType
|
|
909
|
+
};
|
|
910
|
+
}
|
|
911
|
+
const RESTORE_SOURCE_KEYS = [
|
|
912
|
+
"SourceDBClusterIdentifier",
|
|
913
|
+
"SourceDbClusterResourceId",
|
|
914
|
+
"SnapshotIdentifier"
|
|
915
|
+
];
|
|
916
|
+
function isRestoredRecord(properties) {
|
|
917
|
+
return RESTORE_SOURCE_KEYS.some((key) => {
|
|
918
|
+
const source = properties?.[key];
|
|
919
|
+
return typeof source === "string" && source !== "";
|
|
920
|
+
});
|
|
921
|
+
}
|
|
922
|
+
function unusedRestoreKeys(properties, restore) {
|
|
923
|
+
const pointInTimeKeys = [
|
|
924
|
+
"RestoreType",
|
|
925
|
+
"RestoreToTime",
|
|
926
|
+
"UseLatestRestorableTime"
|
|
927
|
+
];
|
|
928
|
+
const restoreUnused = [
|
|
929
|
+
"GlobalClusterIdentifier",
|
|
930
|
+
"WithExpressConfiguration",
|
|
931
|
+
"ClusterScalabilityType",
|
|
932
|
+
"MasterUserAuthenticationType"
|
|
933
|
+
];
|
|
934
|
+
return (restore === void 0 ? pointInTimeKeys : restore.kind === "snapshot" ? [...restoreUnused, ...pointInTimeKeys] : [
|
|
935
|
+
"AvailabilityZones",
|
|
936
|
+
...restoreUnused,
|
|
937
|
+
"SnapshotIdentifier",
|
|
938
|
+
...restore.useLatestRestorableTime === true ? ["RestoreToTime"] : []
|
|
939
|
+
]).filter((key) => {
|
|
940
|
+
const value = properties[key];
|
|
941
|
+
if (value == null || value === "" || value === false || value === "false") return false;
|
|
942
|
+
return !(Array.isArray(value) && value.length === 0);
|
|
943
|
+
});
|
|
944
|
+
}
|
|
945
|
+
function restoredDifferences(properties, cluster, restore) {
|
|
946
|
+
return (restore.kind === "snapshot" ? [["MasterUsername", cluster.MasterUsername]] : [
|
|
947
|
+
["Engine", cluster.Engine],
|
|
948
|
+
["EngineVersion", cluster.EngineVersion],
|
|
949
|
+
["EngineMode", cluster.EngineMode],
|
|
950
|
+
["MasterUsername", cluster.MasterUsername],
|
|
951
|
+
["DatabaseName", cluster.DatabaseName]
|
|
952
|
+
]).filter(([key, live]) => {
|
|
953
|
+
const declared = properties[key];
|
|
954
|
+
const text = typeof declared === "string" || typeof declared === "number" ? String(declared) : "";
|
|
955
|
+
return text !== "" && live !== void 0 && text !== live;
|
|
956
|
+
}).map(([key]) => key);
|
|
957
|
+
}
|
|
958
|
+
const ARN_IDENTIFIER_REFUSALS = /* @__PURE__ */ new Set(["InvalidParameterValue", "InvalidParameterCombination"]);
|
|
959
|
+
async function readRestoreSource(source, resourceType, logicalId, mask) {
|
|
960
|
+
const wrapSourceReadError = (error) => this.wrapCaughtError(mask, error, (text) => new ProvisioningError(`Failed to create DBCluster ${logicalId}: reading the restore source failed, so nothing was changed: ${text}`, resourceType, logicalId, void 0, error instanceof Error ? error : void 0));
|
|
961
|
+
let found;
|
|
962
|
+
try {
|
|
963
|
+
found = (await this.getClient().send(new DescribeDBClustersCommand({ DBClusterIdentifier: source }))).DBClusters?.[0];
|
|
964
|
+
} catch (error) {
|
|
965
|
+
if (!(source.startsWith("arn:") && error instanceof Error && ARN_IDENTIFIER_REFUSALS.has(error.name)) && !this.isNotFoundError(error, "DBClusterNotFoundFault")) throw wrapSourceReadError(error);
|
|
966
|
+
}
|
|
967
|
+
if (found === void 0 && source.startsWith("arn:")) try {
|
|
968
|
+
let marker;
|
|
969
|
+
do {
|
|
970
|
+
const page = await this.getClient().send(new DescribeDBClustersCommand({
|
|
971
|
+
IncludeShared: true,
|
|
972
|
+
Marker: marker
|
|
973
|
+
}));
|
|
974
|
+
found = page.DBClusters?.find((cluster) => (cluster.DBClusterArn ?? "").toLowerCase() === source.toLowerCase());
|
|
975
|
+
marker = page.Marker;
|
|
976
|
+
} while (found === void 0 && marker !== void 0 && marker !== "");
|
|
977
|
+
} catch (error) {
|
|
978
|
+
throw wrapSourceReadError(error);
|
|
979
|
+
}
|
|
980
|
+
if (found !== void 0) return found;
|
|
981
|
+
throw markNonRetryable(new ProvisioningError(safeMsg`${resourceType} ${logicalId}: SourceDBClusterIdentifier ${source} does not name a DB cluster this account can read, so there is nothing to restore; nothing was changed.`, resourceType, logicalId));
|
|
982
|
+
}
|
|
983
|
+
function isLimitlessEngineVersion(engineVersion) {
|
|
984
|
+
return (engineVersion ?? "").split("-")[1] === "limitless";
|
|
985
|
+
}
|
|
986
|
+
async function readRestoreBackup(resourceId, resourceType, logicalId, mask) {
|
|
987
|
+
const refuse = (reason) => {
|
|
988
|
+
throw markNonRetryable(new ProvisioningError(safeMsg`${resourceType} ${logicalId}: ${reason}; nothing was changed.`, resourceType, logicalId));
|
|
989
|
+
};
|
|
990
|
+
let backup;
|
|
991
|
+
try {
|
|
992
|
+
backup = (await this.getClient().send(new DescribeDBClusterAutomatedBackupsCommand({ DbClusterResourceId: resourceId }))).DBClusterAutomatedBackups?.[0];
|
|
993
|
+
} catch (error) {
|
|
994
|
+
if (!this.isNotFoundError(error, "DBClusterAutomatedBackupNotFoundFault")) throw this.wrapCaughtError(mask, error, (text) => new ProvisioningError(`Failed to create DBCluster ${logicalId}: reading the restore source's automated backups failed, so nothing was changed: ${text}`, resourceType, logicalId, void 0, error instanceof Error ? error : void 0));
|
|
995
|
+
}
|
|
996
|
+
if (backup === void 0) return refuse(`SourceDbClusterResourceId ${resourceId} does not name a DB cluster or retained automated backup this account can read, so there is nothing to restore`);
|
|
997
|
+
const limitless = isLimitlessEngineVersion(backup.EngineVersion);
|
|
998
|
+
if (limitless && backup.Status === "retained") refuse("SourceDbClusterResourceId names a retained automated backup of an Aurora Limitless Database cluster, which can't be restored (automated backup retention isn't supported with Aurora Limitless Database clusters; restore from a manual snapshot instead), as CloudFormation requires");
|
|
999
|
+
return {
|
|
1000
|
+
StorageEncrypted: backup.StorageEncrypted,
|
|
1001
|
+
limitless
|
|
1002
|
+
};
|
|
1003
|
+
}
|
|
1004
|
+
const ACCESS_DENIED_CODES = /* @__PURE__ */ new Set([
|
|
1005
|
+
"AccessDenied",
|
|
1006
|
+
"AccessDeniedException",
|
|
1007
|
+
"NotAuthorized",
|
|
1008
|
+
"UnauthorizedOperation"
|
|
1009
|
+
]);
|
|
1010
|
+
const UNREAD_SNAPSHOT = {
|
|
1011
|
+
limitless: false,
|
|
1012
|
+
storageEncrypted: void 0
|
|
1013
|
+
};
|
|
1014
|
+
function snapshotRestoreStaysUnencrypted(properties, source) {
|
|
1015
|
+
const kmsKeyId = properties["KmsKeyId"];
|
|
1016
|
+
const hasKey = typeof kmsKeyId === "string" ? kmsKeyId !== "" : kmsKeyId != null;
|
|
1017
|
+
return source.storageEncrypted === false && coerceCfnBoolean(properties["StorageEncrypted"]) === true && !hasKey;
|
|
1018
|
+
}
|
|
1019
|
+
async function readRestoreSnapshot(snapshotIdentifier, resourceType, logicalId, mask, restoresFromIt = true) {
|
|
1020
|
+
if (/^arn:[^:]*:rds:[^:]*:[^:]*:snapshot[:/]/.test(snapshotIdentifier)) return UNREAD_SNAPSHOT;
|
|
1021
|
+
let found = false;
|
|
1022
|
+
let engineVersion;
|
|
1023
|
+
let storageEncrypted;
|
|
1024
|
+
try {
|
|
1025
|
+
const snapshot = (await this.getClient().send(new DescribeDBClusterSnapshotsCommand({
|
|
1026
|
+
DBClusterSnapshotIdentifier: snapshotIdentifier,
|
|
1027
|
+
IncludeShared: true,
|
|
1028
|
+
IncludePublic: true
|
|
1029
|
+
}))).DBClusterSnapshots?.[0];
|
|
1030
|
+
found = snapshot !== void 0;
|
|
1031
|
+
engineVersion = snapshot?.EngineVersion;
|
|
1032
|
+
storageEncrypted = snapshot?.StorageEncrypted;
|
|
1033
|
+
} catch (error) {
|
|
1034
|
+
if (ACCESS_DENIED_CODES.has(awsErrorName(error))) {
|
|
1035
|
+
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
|
+
return UNREAD_SNAPSHOT;
|
|
1037
|
+
}
|
|
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));
|
|
1039
|
+
}
|
|
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));
|
|
1041
|
+
return {
|
|
1042
|
+
limitless: isLimitlessEngineVersion(engineVersion),
|
|
1043
|
+
storageEncrypted
|
|
1044
|
+
};
|
|
1045
|
+
}
|
|
1046
|
+
function refuseRestoreEncryption(properties, source, resourceType, logicalId) {
|
|
1047
|
+
const desired = coerceCfnBoolean(properties["StorageEncrypted"]);
|
|
1048
|
+
const kmsKeyId = properties["KmsKeyId"];
|
|
1049
|
+
const hasKey = typeof kmsKeyId === "string" ? kmsKeyId !== "" : kmsKeyId != null;
|
|
1050
|
+
const refuse = (reason) => {
|
|
1051
|
+
throw markNonRetryable(new ProvisioningError(`${resourceType} ${logicalId}: ${reason} Nothing was changed.`, resourceType, logicalId));
|
|
1052
|
+
};
|
|
1053
|
+
if (source.StorageEncrypted === false && desired === true && !hasKey) refuse("StorageEncrypted is true but the restore source is not encrypted and no KmsKeyId is set: you can't create an encrypted DB cluster from an unencrypted source without a KMS key. Set KmsKeyId (alias/aws/rds is the default key), as CloudFormation requires.");
|
|
1054
|
+
if (source.StorageEncrypted === true && desired === false) refuse("StorageEncrypted is false but the restore source is encrypted: a restore of an encrypted source is encrypted. Set StorageEncrypted to true or remove it, as CloudFormation requires.");
|
|
1055
|
+
if (desired === false && hasKey) refuse("a KmsKeyId is set while StorageEncrypted is false: a restore encrypts with the key. Set StorageEncrypted to true or remove the KmsKeyId, as CloudFormation requires.");
|
|
1056
|
+
}
|
|
1057
|
+
function isLimitlessSource(source) {
|
|
1058
|
+
return source.ClusterScalabilityType === "limitless";
|
|
1059
|
+
}
|
|
1060
|
+
function sharedRestoreMembers(properties, tags, logExports) {
|
|
1061
|
+
const string = (key) => properties[key] != null ? properties[key] : void 0;
|
|
1062
|
+
const scaling = properties["ServerlessV2ScalingConfiguration"];
|
|
1063
|
+
const multiAz = clusterCreateMultiAzMembers(properties);
|
|
1064
|
+
const backfill = clusterCreateBackfillMembers(properties);
|
|
1065
|
+
const engineLifecycleSupport = engineLifecycleSupportOf(properties);
|
|
1066
|
+
return {
|
|
1067
|
+
...backfill.CopyTagsToSnapshot !== void 0 && { CopyTagsToSnapshot: backfill.CopyTagsToSnapshot },
|
|
1068
|
+
...multiAz.DBClusterInstanceClass !== void 0 && { DBClusterInstanceClass: multiAz.DBClusterInstanceClass },
|
|
1069
|
+
...multiAz.Iops !== void 0 && { Iops: multiAz.Iops },
|
|
1070
|
+
...string("DBSubnetGroupName") !== void 0 && { DBSubnetGroupName: string("DBSubnetGroupName") },
|
|
1071
|
+
...logExports !== void 0 && logExports.length > 0 && { EnableCloudwatchLogsExports: logExports },
|
|
1072
|
+
...string("KmsKeyId") !== void 0 && { KmsKeyId: string("KmsKeyId") },
|
|
1073
|
+
...string("NetworkType") !== void 0 && { NetworkType: string("NetworkType") },
|
|
1074
|
+
...properties["Port"] != null && { Port: Number(properties["Port"]) },
|
|
1075
|
+
...properties["PubliclyAccessible"] != null && { PubliclyAccessible: properties["PubliclyAccessible"] },
|
|
1076
|
+
...scaling != null && { ServerlessV2ScalingConfiguration: serverlessV2ScalingToSend(scaling) },
|
|
1077
|
+
...backfill.StorageType !== void 0 && { StorageType: backfill.StorageType },
|
|
1078
|
+
...properties["VpcSecurityGroupIds"] != null && { VpcSecurityGroupIds: properties["VpcSecurityGroupIds"] },
|
|
1079
|
+
...engineLifecycleSupport !== void 0 && { EngineLifecycleSupport: engineLifecycleSupport },
|
|
1080
|
+
...tags.length > 0 && { Tags: tags }
|
|
1081
|
+
};
|
|
1082
|
+
}
|
|
1083
|
+
function limitlessRestoreMembers(properties) {
|
|
1084
|
+
const scalars = clusterCreateScalarMembers(properties);
|
|
1085
|
+
return {
|
|
1086
|
+
...properties["MonitoringRoleArn"] != null && { MonitoringRoleArn: properties["MonitoringRoleArn"] },
|
|
1087
|
+
...properties["MonitoringInterval"] != null && { MonitoringInterval: Number(properties["MonitoringInterval"]) },
|
|
1088
|
+
...scalars.EnablePerformanceInsights !== void 0 && { EnablePerformanceInsights: scalars.EnablePerformanceInsights },
|
|
1089
|
+
...scalars.PerformanceInsightsRetentionPeriod !== void 0 && { PerformanceInsightsRetentionPeriod: scalars.PerformanceInsightsRetentionPeriod },
|
|
1090
|
+
...scalars.PerformanceInsightsKMSKeyId !== void 0 && { PerformanceInsightsKMSKeyId: scalars.PerformanceInsightsKMSKeyId }
|
|
1091
|
+
};
|
|
1092
|
+
}
|
|
1093
|
+
function definedMembers(members) {
|
|
1094
|
+
return Object.fromEntries(Object.entries(members).filter(([, value]) => value !== void 0));
|
|
1095
|
+
}
|
|
1096
|
+
function pointInTimeRestoreInput(properties, restore, dbClusterIdentifier, tags, logExports, limitless) {
|
|
1097
|
+
return definedMembers({
|
|
1098
|
+
...sharedRestoreMembers(properties, tags, logExports),
|
|
1099
|
+
DBClusterIdentifier: dbClusterIdentifier,
|
|
1100
|
+
...restore.source.by === "identifier" ? { SourceDBClusterIdentifier: restore.source.value } : { SourceDbClusterResourceId: restore.source.value },
|
|
1101
|
+
RestoreType: restore.restoreType,
|
|
1102
|
+
UseLatestRestorableTime: restore.useLatestRestorableTime,
|
|
1103
|
+
RestoreToTime: restore.restoreToTime,
|
|
1104
|
+
...limitless && limitlessRestoreMembers(properties)
|
|
1105
|
+
});
|
|
1106
|
+
}
|
|
1107
|
+
function snapshotRestoreInput(properties, restore, dbClusterIdentifier, tags, logExports, availabilityZones, limitless) {
|
|
1108
|
+
const string = (key) => properties[key] != null ? properties[key] : void 0;
|
|
1109
|
+
const boolean = (key) => properties[key] != null ? properties[key] : void 0;
|
|
1110
|
+
return definedMembers({
|
|
1111
|
+
...sharedRestoreMembers(properties, tags, logExports),
|
|
1112
|
+
DBClusterIdentifier: dbClusterIdentifier,
|
|
1113
|
+
SnapshotIdentifier: restore.snapshotIdentifier,
|
|
1114
|
+
Engine: string("Engine"),
|
|
1115
|
+
EngineVersion: string("EngineVersion"),
|
|
1116
|
+
EngineMode: string("EngineMode"),
|
|
1117
|
+
DatabaseName: string("DatabaseName"),
|
|
1118
|
+
DBClusterParameterGroupName: clusterCreateBackfillMembers(properties).DBClusterParameterGroupName,
|
|
1119
|
+
DeletionProtection: boolean("DeletionProtection"),
|
|
1120
|
+
EnableIAMDatabaseAuthentication: boolean("EnableIAMDatabaseAuthentication"),
|
|
1121
|
+
BacktrackWindow: clusterCreateScalarMembers(properties).BacktrackWindow,
|
|
1122
|
+
...availabilityZones !== void 0 && availabilityZones.length > 0 && { AvailabilityZones: availabilityZones },
|
|
1123
|
+
...limitless && limitlessRestoreMembers(properties)
|
|
1124
|
+
});
|
|
1125
|
+
}
|
|
1126
|
+
async function sendClusterRestore(properties, restore, call) {
|
|
1127
|
+
const { dbClusterIdentifier, tags, logExports, availabilityZones, limitless } = call;
|
|
1128
|
+
return restore.kind === "snapshot" ? this.getCreateClient().send(new RestoreDBClusterFromSnapshotCommand(snapshotRestoreInput(properties, restore, dbClusterIdentifier, tags, logExports, availabilityZones, limitless))) : this.getCreateClient().send(new RestoreDBClusterToPointInTimeCommand(pointInTimeRestoreInput(properties, restore, dbClusterIdentifier, tags, logExports, limitless)));
|
|
1129
|
+
}
|
|
1130
|
+
const DEFAULT_BACKUP_RETENTION_PERIOD = 1;
|
|
1131
|
+
function restoreFollowUp(properties, logExports, limitless) {
|
|
1132
|
+
const multiAz = clusterCreateMultiAzMembers(properties);
|
|
1133
|
+
const backfill = clusterCreateBackfillMembers(properties);
|
|
1134
|
+
const { EngineLifecycleSupport: _lifecycle, MasterUserAuthenticationType: _authentication, BacktrackWindow: backtrackWindow, ...scalars } = clusterCreateScalarMembers(properties);
|
|
1135
|
+
const serverlessV1 = properties["EngineMode"] === "serverless";
|
|
1136
|
+
const managed = coerceCfnBoolean(properties["ManageMasterUserPassword"]) === true;
|
|
1137
|
+
const masterUserSecret = properties["MasterUserSecret"];
|
|
1138
|
+
const allocatedStorage = clusterSizeValue(properties["AllocatedStorage"]);
|
|
1139
|
+
const members = {
|
|
1140
|
+
...scalars,
|
|
1141
|
+
BackupRetentionPeriod: properties["BackupRetentionPeriod"] != null ? Number(properties["BackupRetentionPeriod"]) : DEFAULT_BACKUP_RETENTION_PERIOD,
|
|
1142
|
+
...logExports !== void 0 && logExports.length > 0 && { CloudwatchLogsExportConfiguration: { EnableLogTypes: logExports } },
|
|
1143
|
+
...backfill,
|
|
1144
|
+
...multiAz.DBClusterInstanceClass !== void 0 && { DBClusterInstanceClass: multiAz.DBClusterInstanceClass },
|
|
1145
|
+
...multiAz.Iops !== void 0 && { Iops: multiAz.Iops },
|
|
1146
|
+
...properties["DeletionProtection"] != null && { DeletionProtection: properties["DeletionProtection"] },
|
|
1147
|
+
...properties["MasterUserPassword"] != null && { MasterUserPassword: properties["MasterUserPassword"] },
|
|
1148
|
+
...properties["MonitoringInterval"] != null && { MonitoringInterval: Number(properties["MonitoringInterval"]) },
|
|
1149
|
+
...properties["MonitoringRoleArn"] != null && { MonitoringRoleArn: properties["MonitoringRoleArn"] },
|
|
1150
|
+
...serverlessV1 ? properties["EnableHttpEndpoint"] != null && { EnableHttpEndpoint: coerceCfnBoolean(properties["EnableHttpEndpoint"]) } : {
|
|
1151
|
+
...typeof allocatedStorage === "number" && { AllocatedStorage: allocatedStorage },
|
|
1152
|
+
...backtrackWindow !== void 0 && { BacktrackWindow: backtrackWindow },
|
|
1153
|
+
...properties["EnableIAMDatabaseAuthentication"] != null && { EnableIAMDatabaseAuthentication: properties["EnableIAMDatabaseAuthentication"] }
|
|
1154
|
+
},
|
|
1155
|
+
...managed && {
|
|
1156
|
+
ManageMasterUserPassword: true,
|
|
1157
|
+
...masterUserSecret?.KmsKeyId !== void 0 && { MasterUserSecretKmsKeyId: masterUserSecret.KmsKeyId }
|
|
1158
|
+
}
|
|
1159
|
+
};
|
|
1160
|
+
if (serverlessV1) delete members.PreferredBackupWindow;
|
|
1161
|
+
if (limitless) {
|
|
1162
|
+
delete members.StorageType;
|
|
1163
|
+
delete members.EnablePerformanceInsights;
|
|
1164
|
+
delete members.PerformanceInsightsKMSKeyId;
|
|
1165
|
+
delete members.CloudwatchLogsExportConfiguration;
|
|
1166
|
+
}
|
|
1167
|
+
return members;
|
|
1168
|
+
}
|
|
1169
|
+
function restoreWaitMs() {
|
|
1170
|
+
const remaining = enclosingDeadlineRemainingMs() - 3e4;
|
|
1171
|
+
return Number.isFinite(remaining) ? Math.max(18e5, remaining) : 18e5;
|
|
1172
|
+
}
|
|
1173
|
+
async function sendRestoreFollowUp(logicalId, physicalId, members) {
|
|
1174
|
+
await modifyDbInstanceWhenAvailable({
|
|
1175
|
+
send: () => this.getClient().send(new ModifyDBClusterCommand({
|
|
1176
|
+
DBClusterIdentifier: physicalId,
|
|
1177
|
+
...members,
|
|
1178
|
+
ApplyImmediately: true
|
|
1179
|
+
})),
|
|
1180
|
+
readStatus: async () => (await this.describeDBCluster(physicalId))?.Status,
|
|
1181
|
+
sleep: (ms) => this.sleep(ms),
|
|
1182
|
+
logger: this.logger,
|
|
1183
|
+
label: "DBCluster",
|
|
1184
|
+
subject: "cluster",
|
|
1185
|
+
action: "create",
|
|
1186
|
+
logicalId,
|
|
1187
|
+
remainingMs: enclosingDeadlineRemainingMs()
|
|
1188
|
+
});
|
|
1189
|
+
}
|
|
1190
|
+
|
|
837
1191
|
// src/provisioning/providers/rds/cluster-create.ts
|
|
838
1192
|
async function createDBCluster(logicalId, resourceType, properties, mask, replaying = false) {
|
|
839
1193
|
this.logger.debug(`Creating DBCluster ${logicalId}`);
|
|
@@ -858,7 +1212,10 @@ async function createDBCluster(logicalId, resourceType, properties, mask, replay
|
|
|
858
1212
|
const globalClusterId = globalClusterSkipped ? void 0 : recordedGlobalClusterIdentifier(properties);
|
|
859
1213
|
const expressFlag = expressConfigurationFlag(properties["WithExpressConfiguration"]);
|
|
860
1214
|
const expressSkipped = expressFlag === "malformed";
|
|
861
|
-
const
|
|
1215
|
+
const restore = readClusterRestore(properties, resourceType, logicalId);
|
|
1216
|
+
const express = expressFlag === true && restore === void 0;
|
|
1217
|
+
const unused = unusedRestoreKeys(properties, restore);
|
|
1218
|
+
if (unused.length > 0) this.logger.warn(safeMsg`DBCluster ${logicalId}: this ${restore === void 0 ? "create" : `${restore.kind} restore`} does not apply ${unused.join(", ")}, as in CloudFormation.`);
|
|
862
1219
|
const classSkipped = malformedInstanceClass(properties["DBClusterInstanceClass"]);
|
|
863
1220
|
const allocatedSkipped = clusterSizeValue(properties["AllocatedStorage"]) === "malformed";
|
|
864
1221
|
const iopsSkipped = clusterSizeValue(properties["Iops"]) === "malformed";
|
|
@@ -941,12 +1298,35 @@ async function createDBCluster(logicalId, resourceType, properties, mask, replay
|
|
|
941
1298
|
const effectiveProperties = skippedKeys.length > 0 ? Object.fromEntries(Object.entries(properties).filter(([key]) => !skippedKeys.includes(key))) : void 0;
|
|
942
1299
|
const logExports = desiredLogExports(properties, resourceType, logicalId);
|
|
943
1300
|
const dbClusterIdentifier = properties["DBClusterIdentifier"] || generatedNameFor("AWS::RDS::DBCluster", logicalId, { properties });
|
|
1301
|
+
if (restore !== void 0 && !(restore.kind === "point-in-time" && restore.source.by === "identifier" && /^arn:/i.test(restore.source.value))) refuseRestoreFromItself(resourceType, properties, dbClusterIdentifier, logicalId, {});
|
|
1302
|
+
let limitless = false;
|
|
1303
|
+
const declaredSnapshot = properties["SnapshotIdentifier"];
|
|
1304
|
+
if (restore?.kind === "point-in-time" && typeof declaredSnapshot === "string" && declaredSnapshot !== "") await readRestoreSnapshot.call(this, declaredSnapshot, resourceType, logicalId, mask, false);
|
|
1305
|
+
if (restore?.kind === "point-in-time" && restore.source.by === "identifier") {
|
|
1306
|
+
const source = await readRestoreSource.call(this, restore.source.value, resourceType, logicalId, mask);
|
|
1307
|
+
refuseRestoreEncryption(properties, source, resourceType, logicalId);
|
|
1308
|
+
limitless = isLimitlessSource(source);
|
|
1309
|
+
} else if (restore?.kind === "point-in-time") {
|
|
1310
|
+
const backup = await readRestoreBackup.call(this, restore.source.value, resourceType, logicalId, mask);
|
|
1311
|
+
refuseRestoreEncryption(properties, backup, resourceType, logicalId);
|
|
1312
|
+
limitless = backup.limitless;
|
|
1313
|
+
} else if (restore?.kind === "snapshot") {
|
|
1314
|
+
const snapshot = await readRestoreSnapshot.call(this, restore.snapshotIdentifier, resourceType, logicalId, mask);
|
|
1315
|
+
limitless = snapshot.limitless;
|
|
1316
|
+
if (snapshotRestoreStaysUnencrypted(properties, snapshot)) this.logger.warn(safeMsg`DBCluster ${logicalId}: StorageEncrypted is true but the restore snapshot is not encrypted and no KmsKeyId is set, so the restored cluster is not encrypted, as in CloudFormation. Set KmsKeyId (alias/aws/rds is the default key) to encrypt it.`);
|
|
1317
|
+
}
|
|
944
1318
|
let clusterLeftBehind = false;
|
|
945
1319
|
let createdResourceId;
|
|
946
1320
|
try {
|
|
947
1321
|
const serverlessV2Config = properties["ServerlessV2ScalingConfiguration"];
|
|
948
1322
|
const masterUserSecret = properties["MasterUserSecret"];
|
|
949
|
-
const response = await
|
|
1323
|
+
const response = await (restore !== void 0 ? sendClusterRestore.call(this, properties, restore, {
|
|
1324
|
+
dbClusterIdentifier,
|
|
1325
|
+
tags,
|
|
1326
|
+
logExports,
|
|
1327
|
+
availabilityZones,
|
|
1328
|
+
limitless
|
|
1329
|
+
}) : this.getCreateClient().send(new CreateDBClusterCommand({
|
|
950
1330
|
DBClusterIdentifier: dbClusterIdentifier,
|
|
951
1331
|
Engine: properties["Engine"],
|
|
952
1332
|
EngineVersion: properties["EngineVersion"],
|
|
@@ -978,16 +1358,31 @@ async function createDBCluster(logicalId, resourceType, properties, mask, replay
|
|
|
978
1358
|
...globalClusterId !== void 0 && { GlobalClusterIdentifier: globalClusterId },
|
|
979
1359
|
...expressFlag !== void 0 && !expressSkipped && { WithExpressConfiguration: express },
|
|
980
1360
|
...tags.length > 0 && { Tags: tags }
|
|
981
|
-
}));
|
|
1361
|
+
})));
|
|
982
1362
|
clusterLeftBehind = true;
|
|
983
1363
|
createdResourceId = response.DBCluster?.DbClusterResourceId;
|
|
984
1364
|
reportCreatedResource(logicalId, resourceType, dbClusterIdentifier, createdResourceId);
|
|
985
|
-
|
|
1365
|
+
const cluster = response.DBCluster;
|
|
1366
|
+
if (!cluster) throw new Error(`${restoreCallName(restore)} did not return DBCluster`);
|
|
1367
|
+
if (restore !== void 0) {
|
|
1368
|
+
const differs = restoredDifferences(properties, cluster, restore);
|
|
1369
|
+
if (differs.length > 0) this.logger.warn(safeMsg`DBCluster ${logicalId}: the restored cluster keeps its source's ${differs.join(", ")}, not the template's, as in CloudFormation: a restore does not set ${differs.length === 1 ? "it" : "them"}.`);
|
|
1370
|
+
}
|
|
986
1371
|
this.logger.debug(`Successfully created DBCluster ${logicalId}: ${dbClusterIdentifier}`);
|
|
987
1372
|
const wantsDeletionProtection = properties["DeletionProtection"] === true;
|
|
988
1373
|
try {
|
|
1374
|
+
if (restore !== void 0) {
|
|
1375
|
+
await this.waitForClusterAvailable(logicalId, dbClusterIdentifier, restoreWaitMs(), "being restored");
|
|
1376
|
+
await sendRestoreFollowUp.call(this, logicalId, dbClusterIdentifier, restoreFollowUp(properties, logExports, limitless));
|
|
1377
|
+
if (httpEndpoint === true && properties["EngineMode"] !== "serverless") {
|
|
1378
|
+
const arn = cluster.DBClusterArn ?? (await this.describeDBCluster(dbClusterIdentifier))?.DBClusterArn;
|
|
1379
|
+
if (arn === void 0) throw new Error("The restored DBCluster has no ARN to enable the Data API on");
|
|
1380
|
+
await this.sendHttpEndpointChange(logicalId, dbClusterIdentifier, arn, true);
|
|
1381
|
+
if (process.env["CDKD_NO_WAIT"] !== "true") await this.waitForClusterState(logicalId, dbClusterIdentifier, (live) => live.HttpEndpointEnabled === true, "HTTP endpoint (Data API) setting");
|
|
1382
|
+
}
|
|
1383
|
+
}
|
|
989
1384
|
if (process.env["CDKD_NO_WAIT"] !== "true") {
|
|
990
|
-
await this.waitForClusterAvailable(logicalId, dbClusterIdentifier);
|
|
1385
|
+
await this.waitForClusterAvailable(logicalId, dbClusterIdentifier, restore === void 0 ? void 0 : restoreWaitMs(), restore === void 0 ? void 0 : "applying the restored cluster settings");
|
|
991
1386
|
if (localWriteForwardingFlag(properties["EnableLocalWriteForwarding"]) === true) await this.waitForClusterState(logicalId, dbClusterIdentifier, (cluster) => localWriteForwardingApplied(cluster, true), "local write forwarding setting");
|
|
992
1387
|
if (express) await this.waitForInstanceAvailable(logicalId, expressWriterIdentifier(dbClusterIdentifier));
|
|
993
1388
|
}
|
|
@@ -1206,7 +1601,7 @@ async function updateDBCluster(logicalId, physicalId, resourceType, properties,
|
|
|
1206
1601
|
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`);
|
|
1207
1602
|
skippedKeys.push(["AllocatedStorage", usableClusterSize]);
|
|
1208
1603
|
});
|
|
1209
|
-
if (globalClusterPlan.kind === "detach") {
|
|
1604
|
+
if (globalClusterPlan.kind === "detach" && !await restoredOutsideGlobalCluster.call(this, previousProperties, physicalId, globalClusterPlan.globalClusterId)) {
|
|
1210
1605
|
if (await this.detachFromGlobalCluster(logicalId, physicalId, globalClusterPlan.globalClusterId, {
|
|
1211
1606
|
beforeDelete: false,
|
|
1212
1607
|
removeProtection: false
|
|
@@ -1310,6 +1705,7 @@ async function planGlobalClusterUpdate(physicalId, properties, previousPropertie
|
|
|
1310
1705
|
if (!stateBorne || desiredId === void 0) return { kind: "none" };
|
|
1311
1706
|
const live = await liveGlobalClusterMembership.call(this, physicalId, desiredId);
|
|
1312
1707
|
if (live.kind !== "answered" || live.member) return { kind: "none" };
|
|
1708
|
+
if (isRestoredRecord(previousProperties)) return { kind: "none" };
|
|
1313
1709
|
this.logger.warn(mask(safeMsg`${logicalId} (${resourceType}): the cluster is no longer a member of global cluster ${desiredId}, so the record drops GlobalClusterIdentifier.`));
|
|
1314
1710
|
return { kind: "drop" };
|
|
1315
1711
|
}
|
|
@@ -1350,9 +1746,10 @@ async function liveGlobalClusterMembership(physicalId, desiredId) {
|
|
|
1350
1746
|
}
|
|
1351
1747
|
marker = page.Marker;
|
|
1352
1748
|
} while (marker);
|
|
1749
|
+
const idOf = (id) => id === void 0 ? void 0 : (id.split(":").pop() ?? id).toLowerCase();
|
|
1353
1750
|
return {
|
|
1354
1751
|
kind: "answered",
|
|
1355
|
-
member: liveId === desiredId
|
|
1752
|
+
member: idOf(liveId) === idOf(desiredId)
|
|
1356
1753
|
};
|
|
1357
1754
|
} catch (error) {
|
|
1358
1755
|
const failure = describeAwsFailure(error);
|
|
@@ -1363,6 +1760,11 @@ async function liveGlobalClusterMembership(physicalId, desiredId) {
|
|
|
1363
1760
|
};
|
|
1364
1761
|
}
|
|
1365
1762
|
}
|
|
1763
|
+
async function restoredOutsideGlobalCluster(properties, physicalId, globalClusterId) {
|
|
1764
|
+
if (!isRestoredRecord(properties)) return false;
|
|
1765
|
+
const live = await liveGlobalClusterMembership.call(this, physicalId, globalClusterId);
|
|
1766
|
+
return live.kind === "answered" && !live.member;
|
|
1767
|
+
}
|
|
1366
1768
|
|
|
1367
1769
|
// src/provisioning/providers/rds/cluster-delete.ts
|
|
1368
1770
|
async function deleteDBCluster(logicalId, physicalId, resourceType, properties, context) {
|
|
@@ -1442,13 +1844,15 @@ async function deleteDBClusterOnce(logicalId, physicalId, resourceType, properti
|
|
|
1442
1844
|
} catch (disableError) {
|
|
1443
1845
|
if (!this.isNotFoundError(disableError, "DBClusterNotFoundFault")) this.logger.debug(maskerOrIdentity(context?.maskSecrets)(`Could not disable deletion protection for DBCluster ${logicalId}: ${describeAwsFailure(disableError).detail}`));
|
|
1444
1846
|
}
|
|
1847
|
+
const restored = isRestoredRecord(properties);
|
|
1445
1848
|
const globalClusterId = recordedGlobalClusterIdentifier(properties);
|
|
1446
|
-
if (globalClusterId !== void 0) detachedFrom = await this.detachFromGlobalCluster(logicalId, physicalId, globalClusterId, {
|
|
1849
|
+
if (globalClusterId !== void 0 && !await restoredOutsideGlobalCluster.call(this, properties, physicalId, globalClusterId)) detachedFrom = await this.detachFromGlobalCluster(logicalId, physicalId, globalClusterId, {
|
|
1447
1850
|
beforeDelete: true,
|
|
1448
1851
|
removeProtection: context?.removeProtection === true
|
|
1449
1852
|
}, progress, maskerOrIdentity(context?.maskSecrets)) ? globalClusterId : void 0;
|
|
1450
|
-
|
|
1451
|
-
|
|
1853
|
+
const recordedWriterId = recordedExpressWriterId(context?.recordedAttributes);
|
|
1854
|
+
if (!(restored && recordedWriterId === void 0) && expressConfigurationFlag(properties?.["WithExpressConfiguration"]) === true) {
|
|
1855
|
+
if (await deleteExpressWriter.call(this, logicalId, physicalId, await this.describeDBCluster(physicalId), recordedWriterId, flip.flippedOffByThisRun, maskerOrIdentity(context?.maskSecrets))) progress.stripped = true;
|
|
1452
1856
|
}
|
|
1453
1857
|
const finalSnapshotId = context?.finalSnapshotIdentifier;
|
|
1454
1858
|
const sendDelete = () => this.getClient().send(new DeleteDBClusterCommand({
|
|
@@ -1878,6 +2282,9 @@ async function createDBInstance(logicalId, resourceType, properties, mask, repla
|
|
|
1878
2282
|
...logExports !== void 0 && logExports.length > 0 && { EnableCloudwatchLogsExports: logExports },
|
|
1879
2283
|
...properties["DBName"] != null && { DBName: properties["DBName"] },
|
|
1880
2284
|
...properties["AvailabilityZone"] != null && { AvailabilityZone: properties["AvailabilityZone"] },
|
|
2285
|
+
...properties["CharacterSetName"] != null && { CharacterSetName: properties["CharacterSetName"] },
|
|
2286
|
+
...properties["NcharCharacterSetName"] != null && { NcharCharacterSetName: properties["NcharCharacterSetName"] },
|
|
2287
|
+
...properties["Timezone"] != null && { Timezone: properties["Timezone"] },
|
|
1881
2288
|
...processor.features !== void 0 && { ProcessorFeatures: processor.features },
|
|
1882
2289
|
...tags.length > 0 && { Tags: tags }
|
|
1883
2290
|
});
|
|
@@ -2496,7 +2903,13 @@ function getDriftUnknownPaths(resourceType, properties) {
|
|
|
2496
2903
|
"MasterUserAuthenticationType",
|
|
2497
2904
|
"GlobalClusterIdentifier",
|
|
2498
2905
|
"DBInstanceParameterGroupName",
|
|
2499
|
-
"WithExpressConfiguration"
|
|
2906
|
+
"WithExpressConfiguration",
|
|
2907
|
+
"SourceDBClusterIdentifier",
|
|
2908
|
+
"SourceDbClusterResourceId",
|
|
2909
|
+
"SnapshotIdentifier",
|
|
2910
|
+
"RestoreToTime",
|
|
2911
|
+
"RestoreType",
|
|
2912
|
+
"UseLatestRestorableTime"
|
|
2500
2913
|
];
|
|
2501
2914
|
if (properties === void 0 || Object.keys(properties).length === 0) return neverRead;
|
|
2502
2915
|
return (properties?.["ServerlessV2ScalingConfiguration"])?.SecondsUntilAutoPause === void 0 ? [...neverRead, "ServerlessV2ScalingConfiguration.SecondsUntilAutoPause"] : neverRead;
|
|
@@ -2705,6 +3118,11 @@ async function readCurrentStateDBInstance(physicalId) {
|
|
|
2705
3118
|
}
|
|
2706
3119
|
if (inst.DBName !== void 0) result["DBName"] = inst.DBName;
|
|
2707
3120
|
if (inst.AvailabilityZone !== void 0 && inst.MultiAZ !== true) result["AvailabilityZone"] = inst.AvailabilityZone;
|
|
3121
|
+
for (const key of [
|
|
3122
|
+
"CharacterSetName",
|
|
3123
|
+
"NcharCharacterSetName",
|
|
3124
|
+
"Timezone"
|
|
3125
|
+
]) if (inst[key] !== void 0) result[key] = inst[key];
|
|
2708
3126
|
if (inst.EngineLifecycleSupport !== void 0 && inst.DBClusterIdentifier === void 0) result["EngineLifecycleSupport"] = inst.EngineLifecycleSupport;
|
|
2709
3127
|
const liveSource = inst.ReadReplicaSourceDBInstanceIdentifier;
|
|
2710
3128
|
if (liveSource !== void 0 && liveSource !== "") {
|
|
@@ -2882,7 +3300,13 @@ var RDSProvider = class {
|
|
|
2882
3300
|
"AllocatedStorage",
|
|
2883
3301
|
"Iops",
|
|
2884
3302
|
"DBInstanceParameterGroupName",
|
|
2885
|
-
"WithExpressConfiguration"
|
|
3303
|
+
"WithExpressConfiguration",
|
|
3304
|
+
"SourceDBClusterIdentifier",
|
|
3305
|
+
"SourceDbClusterResourceId",
|
|
3306
|
+
"SnapshotIdentifier",
|
|
3307
|
+
"RestoreToTime",
|
|
3308
|
+
"RestoreType",
|
|
3309
|
+
"UseLatestRestorableTime"
|
|
2886
3310
|
])],
|
|
2887
3311
|
["AWS::RDS::DBInstance", /* @__PURE__ */ new Set([
|
|
2888
3312
|
"DBInstanceIdentifier",
|
|
@@ -2941,7 +3365,10 @@ var RDSProvider = class {
|
|
|
2941
3365
|
"UseDefaultProcessorFeatures",
|
|
2942
3366
|
"AutomaticBackupReplicationRegion",
|
|
2943
3367
|
"AutomaticBackupReplicationKmsKeyId",
|
|
2944
|
-
"AutomaticBackupReplicationRetentionPeriod"
|
|
3368
|
+
"AutomaticBackupReplicationRetentionPeriod",
|
|
3369
|
+
"CharacterSetName",
|
|
3370
|
+
"NcharCharacterSetName",
|
|
3371
|
+
"Timezone"
|
|
2945
3372
|
])]
|
|
2946
3373
|
]);
|
|
2947
3374
|
unhandledByDesign = /* @__PURE__ */ new Map([["AWS::RDS::DBCluster", /* @__PURE__ */ new Map([
|
|
@@ -3163,4 +3590,4 @@ var RDSProvider = class {
|
|
|
3163
3590
|
};
|
|
3164
3591
|
|
|
3165
3592
|
export { RDSProvider };
|
|
3166
|
-
//# sourceMappingURL=rds-provider-
|
|
3593
|
+
//# sourceMappingURL=rds-provider-CaaoK9Yu.js.map
|