@cdkd/cli 0.340.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-DrQNWTtu.js → asg-provider-BT_0gh9s.js} +5 -5
- package/dist/{asg-provider-DrQNWTtu.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-BJSwxkSE.js → db-instance-modify-retry-CCbm-DKl.js} +4 -4
- package/dist/{db-instance-modify-retry-BJSwxkSE.js.map → db-instance-modify-retry-CCbm-DKl.js.map} +1 -1
- package/dist/{deploy-engine-Bn_aBFb7.js → deploy-engine-BZSAOzE6.js} +4158 -4085
- package/dist/deploy-engine-BZSAOzE6.js.map +1 -0
- package/dist/{ecr-uri-B5zqA138.js → ecr-uri-DmkrTyRF.js} +3 -3
- package/dist/{ecr-uri-B5zqA138.js.map → ecr-uri-DmkrTyRF.js.map} +1 -1
- package/dist/{iam-role-provider-CRHaUz5M.js → iam-role-provider-CbUqsAAi.js} +5 -5
- package/dist/{iam-role-provider-CRHaUz5M.js.map → iam-role-provider-CbUqsAAi.js.map} +1 -1
- package/dist/index.js +4 -4
- package/dist/{neptune-provider-BL93NXUx.js → neptune-provider-DlQ-_thp.js} +6 -6
- package/dist/{neptune-provider-BL93NXUx.js.map → neptune-provider-DlQ-_thp.js.map} +1 -1
- package/dist/{program-CuJKRAac.js → program-7VC8uSCL.js} +17 -10
- package/dist/program-7VC8uSCL.js.map +1 -0
- package/dist/{provider-classes-CRZ8a4sy.js → provider-classes-0cQAzv7Y.js} +282 -153
- package/dist/provider-classes-0cQAzv7Y.js.map +1 -0
- package/dist/{rds-provider-B-LP69hz.js → rds-provider-CaaoK9Yu.js} +202 -49
- package/dist/rds-provider-CaaoK9Yu.js.map +1 -0
- package/dist/{read-replica-DblnJp2B.js → read-replica-DyG0ZkQJ.js} +3 -3
- package/dist/{read-replica-DblnJp2B.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-Y2LIzQUU.js → version-B7cmr9JA.js} +2 -2
- package/dist/{version-Y2LIzQUU.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-Bn_aBFb7.js.map +0 -1
- package/dist/program-CuJKRAac.js.map +0 -1
- package/dist/provider-classes-CRZ8a4sy.js.map +0 -1
- package/dist/rds-provider-B-LP69hz.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, RestoreDBClusterToPointInTimeCommand, 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"));
|
|
@@ -835,6 +835,10 @@ async function deleteExpressWriter(logicalId, physicalId, cluster, recordedWrite
|
|
|
835
835
|
}
|
|
836
836
|
|
|
837
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
|
+
}
|
|
838
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}))?)?)(?:\[[^\]]+\])?$/;
|
|
839
843
|
function parseZonedTimestamp(text) {
|
|
840
844
|
const match = ZONED_DATE_TIME.exec(text);
|
|
@@ -875,34 +879,62 @@ function readClusterRestore(properties, resourceType, logicalId) {
|
|
|
875
879
|
const declaredLatest = properties["UseLatestRestorableTime"];
|
|
876
880
|
const useLatestRestorableTime = declaredLatest == null ? void 0 : coerceCfnBoolean(declaredLatest);
|
|
877
881
|
if (declaredLatest != null && useLatestRestorableTime === void 0) return refuse("UseLatestRestorableTime must be true or false");
|
|
878
|
-
const
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
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
|
+
};
|
|
884
897
|
return {
|
|
885
|
-
|
|
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
|
+
},
|
|
886
906
|
restoreToTime: useLatestRestorableTime === true ? void 0 : restoreToTime,
|
|
887
907
|
useLatestRestorableTime,
|
|
888
|
-
restoreType
|
|
908
|
+
restoreType
|
|
889
909
|
};
|
|
890
910
|
}
|
|
911
|
+
const RESTORE_SOURCE_KEYS = [
|
|
912
|
+
"SourceDBClusterIdentifier",
|
|
913
|
+
"SourceDbClusterResourceId",
|
|
914
|
+
"SnapshotIdentifier"
|
|
915
|
+
];
|
|
891
916
|
function isRestoredRecord(properties) {
|
|
892
|
-
|
|
893
|
-
|
|
917
|
+
return RESTORE_SOURCE_KEYS.some((key) => {
|
|
918
|
+
const source = properties?.[key];
|
|
919
|
+
return typeof source === "string" && source !== "";
|
|
920
|
+
});
|
|
894
921
|
}
|
|
895
922
|
function unusedRestoreKeys(properties, restore) {
|
|
896
|
-
|
|
923
|
+
const pointInTimeKeys = [
|
|
897
924
|
"RestoreType",
|
|
898
925
|
"RestoreToTime",
|
|
899
926
|
"UseLatestRestorableTime"
|
|
900
|
-
]
|
|
901
|
-
|
|
927
|
+
];
|
|
928
|
+
const restoreUnused = [
|
|
902
929
|
"GlobalClusterIdentifier",
|
|
903
930
|
"WithExpressConfiguration",
|
|
904
931
|
"ClusterScalabilityType",
|
|
905
|
-
"MasterUserAuthenticationType"
|
|
932
|
+
"MasterUserAuthenticationType"
|
|
933
|
+
];
|
|
934
|
+
return (restore === void 0 ? pointInTimeKeys : restore.kind === "snapshot" ? [...restoreUnused, ...pointInTimeKeys] : [
|
|
935
|
+
"AvailabilityZones",
|
|
936
|
+
...restoreUnused,
|
|
937
|
+
"SnapshotIdentifier",
|
|
906
938
|
...restore.useLatestRestorableTime === true ? ["RestoreToTime"] : []
|
|
907
939
|
]).filter((key) => {
|
|
908
940
|
const value = properties[key];
|
|
@@ -910,14 +942,18 @@ function unusedRestoreKeys(properties, restore) {
|
|
|
910
942
|
return !(Array.isArray(value) && value.length === 0);
|
|
911
943
|
});
|
|
912
944
|
}
|
|
913
|
-
function restoredDifferences(properties, cluster) {
|
|
914
|
-
return [
|
|
945
|
+
function restoredDifferences(properties, cluster, restore) {
|
|
946
|
+
return (restore.kind === "snapshot" ? [["MasterUsername", cluster.MasterUsername]] : [
|
|
915
947
|
["Engine", cluster.Engine],
|
|
916
948
|
["EngineVersion", cluster.EngineVersion],
|
|
917
949
|
["EngineMode", cluster.EngineMode],
|
|
918
950
|
["MasterUsername", cluster.MasterUsername],
|
|
919
951
|
["DatabaseName", cluster.DatabaseName]
|
|
920
|
-
].filter(([key, live]) =>
|
|
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);
|
|
921
957
|
}
|
|
922
958
|
const ARN_IDENTIFIER_REFUSALS = /* @__PURE__ */ new Set(["InvalidParameterValue", "InvalidParameterCombination"]);
|
|
923
959
|
async function readRestoreSource(source, resourceType, logicalId, mask) {
|
|
@@ -944,6 +980,69 @@ async function readRestoreSource(source, resourceType, logicalId, mask) {
|
|
|
944
980
|
if (found !== void 0) return found;
|
|
945
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));
|
|
946
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
|
+
}
|
|
947
1046
|
function refuseRestoreEncryption(properties, source, resourceType, logicalId) {
|
|
948
1047
|
const desired = coerceCfnBoolean(properties["StorageEncrypted"]);
|
|
949
1048
|
const kmsKeyId = properties["KmsKeyId"];
|
|
@@ -958,19 +1057,13 @@ function refuseRestoreEncryption(properties, source, resourceType, logicalId) {
|
|
|
958
1057
|
function isLimitlessSource(source) {
|
|
959
1058
|
return source.ClusterScalabilityType === "limitless";
|
|
960
1059
|
}
|
|
961
|
-
function
|
|
1060
|
+
function sharedRestoreMembers(properties, tags, logExports) {
|
|
962
1061
|
const string = (key) => properties[key] != null ? properties[key] : void 0;
|
|
963
1062
|
const scaling = properties["ServerlessV2ScalingConfiguration"];
|
|
964
1063
|
const multiAz = clusterCreateMultiAzMembers(properties);
|
|
965
1064
|
const backfill = clusterCreateBackfillMembers(properties);
|
|
966
|
-
const scalars = clusterCreateScalarMembers(properties);
|
|
967
1065
|
const engineLifecycleSupport = engineLifecycleSupportOf(properties);
|
|
968
1066
|
return {
|
|
969
|
-
DBClusterIdentifier: dbClusterIdentifier,
|
|
970
|
-
SourceDBClusterIdentifier: restore.sourceDBClusterIdentifier,
|
|
971
|
-
...restore.restoreType !== void 0 && { RestoreType: restore.restoreType },
|
|
972
|
-
...restore.useLatestRestorableTime !== void 0 && { UseLatestRestorableTime: restore.useLatestRestorableTime },
|
|
973
|
-
...restore.restoreToTime !== void 0 && { RestoreToTime: restore.restoreToTime },
|
|
974
1067
|
...backfill.CopyTagsToSnapshot !== void 0 && { CopyTagsToSnapshot: backfill.CopyTagsToSnapshot },
|
|
975
1068
|
...multiAz.DBClusterInstanceClass !== void 0 && { DBClusterInstanceClass: multiAz.DBClusterInstanceClass },
|
|
976
1069
|
...multiAz.Iops !== void 0 && { Iops: multiAz.Iops },
|
|
@@ -984,18 +1077,58 @@ function pointInTimeRestoreInput(properties, restore, dbClusterIdentifier, tags,
|
|
|
984
1077
|
...backfill.StorageType !== void 0 && { StorageType: backfill.StorageType },
|
|
985
1078
|
...properties["VpcSecurityGroupIds"] != null && { VpcSecurityGroupIds: properties["VpcSecurityGroupIds"] },
|
|
986
1079
|
...engineLifecycleSupport !== void 0 && { EngineLifecycleSupport: engineLifecycleSupport },
|
|
987
|
-
...tags.length > 0 && { Tags: tags }
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
}
|
|
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 }
|
|
995
1091
|
};
|
|
996
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
|
+
}
|
|
997
1130
|
const DEFAULT_BACKUP_RETENTION_PERIOD = 1;
|
|
998
|
-
function
|
|
1131
|
+
function restoreFollowUp(properties, logExports, limitless) {
|
|
999
1132
|
const multiAz = clusterCreateMultiAzMembers(properties);
|
|
1000
1133
|
const backfill = clusterCreateBackfillMembers(properties);
|
|
1001
1134
|
const { EngineLifecycleSupport: _lifecycle, MasterUserAuthenticationType: _authentication, BacktrackWindow: backtrackWindow, ...scalars } = clusterCreateScalarMembers(properties);
|
|
@@ -1082,7 +1215,7 @@ async function createDBCluster(logicalId, resourceType, properties, mask, replay
|
|
|
1082
1215
|
const restore = readClusterRestore(properties, resourceType, logicalId);
|
|
1083
1216
|
const express = expressFlag === true && restore === void 0;
|
|
1084
1217
|
const unused = unusedRestoreKeys(properties, restore);
|
|
1085
|
-
if (unused.length > 0) this.logger.warn(safeMsg`DBCluster ${logicalId}: this ${restore === void 0 ? "create" :
|
|
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.`);
|
|
1086
1219
|
const classSkipped = malformedInstanceClass(properties["DBClusterInstanceClass"]);
|
|
1087
1220
|
const allocatedSkipped = clusterSizeValue(properties["AllocatedStorage"]) === "malformed";
|
|
1088
1221
|
const iopsSkipped = clusterSizeValue(properties["Iops"]) === "malformed";
|
|
@@ -1165,19 +1298,35 @@ async function createDBCluster(logicalId, resourceType, properties, mask, replay
|
|
|
1165
1298
|
const effectiveProperties = skippedKeys.length > 0 ? Object.fromEntries(Object.entries(properties).filter(([key]) => !skippedKeys.includes(key))) : void 0;
|
|
1166
1299
|
const logExports = desiredLogExports(properties, resourceType, logicalId);
|
|
1167
1300
|
const dbClusterIdentifier = properties["DBClusterIdentifier"] || generatedNameFor("AWS::RDS::DBCluster", logicalId, { properties });
|
|
1168
|
-
if (restore !== void 0 &&
|
|
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, {});
|
|
1169
1302
|
let limitless = false;
|
|
1170
|
-
|
|
1171
|
-
|
|
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);
|
|
1172
1307
|
refuseRestoreEncryption(properties, source, resourceType, logicalId);
|
|
1173
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.`);
|
|
1174
1317
|
}
|
|
1175
1318
|
let clusterLeftBehind = false;
|
|
1176
1319
|
let createdResourceId;
|
|
1177
1320
|
try {
|
|
1178
1321
|
const serverlessV2Config = properties["ServerlessV2ScalingConfiguration"];
|
|
1179
1322
|
const masterUserSecret = properties["MasterUserSecret"];
|
|
1180
|
-
const response = await (restore !== void 0 ?
|
|
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({
|
|
1181
1330
|
DBClusterIdentifier: dbClusterIdentifier,
|
|
1182
1331
|
Engine: properties["Engine"],
|
|
1183
1332
|
EngineVersion: properties["EngineVersion"],
|
|
@@ -1214,9 +1363,9 @@ async function createDBCluster(logicalId, resourceType, properties, mask, replay
|
|
|
1214
1363
|
createdResourceId = response.DBCluster?.DbClusterResourceId;
|
|
1215
1364
|
reportCreatedResource(logicalId, resourceType, dbClusterIdentifier, createdResourceId);
|
|
1216
1365
|
const cluster = response.DBCluster;
|
|
1217
|
-
if (!cluster) throw new Error(`${restore
|
|
1366
|
+
if (!cluster) throw new Error(`${restoreCallName(restore)} did not return DBCluster`);
|
|
1218
1367
|
if (restore !== void 0) {
|
|
1219
|
-
const differs = restoredDifferences(properties, cluster);
|
|
1368
|
+
const differs = restoredDifferences(properties, cluster, restore);
|
|
1220
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"}.`);
|
|
1221
1370
|
}
|
|
1222
1371
|
this.logger.debug(`Successfully created DBCluster ${logicalId}: ${dbClusterIdentifier}`);
|
|
@@ -1224,7 +1373,7 @@ async function createDBCluster(logicalId, resourceType, properties, mask, replay
|
|
|
1224
1373
|
try {
|
|
1225
1374
|
if (restore !== void 0) {
|
|
1226
1375
|
await this.waitForClusterAvailable(logicalId, dbClusterIdentifier, restoreWaitMs(), "being restored");
|
|
1227
|
-
await sendRestoreFollowUp.call(this, logicalId, dbClusterIdentifier,
|
|
1376
|
+
await sendRestoreFollowUp.call(this, logicalId, dbClusterIdentifier, restoreFollowUp(properties, logExports, limitless));
|
|
1228
1377
|
if (httpEndpoint === true && properties["EngineMode"] !== "serverless") {
|
|
1229
1378
|
const arn = cluster.DBClusterArn ?? (await this.describeDBCluster(dbClusterIdentifier))?.DBClusterArn;
|
|
1230
1379
|
if (arn === void 0) throw new Error("The restored DBCluster has no ARN to enable the Data API on");
|
|
@@ -2756,6 +2905,8 @@ function getDriftUnknownPaths(resourceType, properties) {
|
|
|
2756
2905
|
"DBInstanceParameterGroupName",
|
|
2757
2906
|
"WithExpressConfiguration",
|
|
2758
2907
|
"SourceDBClusterIdentifier",
|
|
2908
|
+
"SourceDbClusterResourceId",
|
|
2909
|
+
"SnapshotIdentifier",
|
|
2759
2910
|
"RestoreToTime",
|
|
2760
2911
|
"RestoreType",
|
|
2761
2912
|
"UseLatestRestorableTime"
|
|
@@ -3151,6 +3302,8 @@ var RDSProvider = class {
|
|
|
3151
3302
|
"DBInstanceParameterGroupName",
|
|
3152
3303
|
"WithExpressConfiguration",
|
|
3153
3304
|
"SourceDBClusterIdentifier",
|
|
3305
|
+
"SourceDbClusterResourceId",
|
|
3306
|
+
"SnapshotIdentifier",
|
|
3154
3307
|
"RestoreToTime",
|
|
3155
3308
|
"RestoreType",
|
|
3156
3309
|
"UseLatestRestorableTime"
|
|
@@ -3437,4 +3590,4 @@ var RDSProvider = class {
|
|
|
3437
3590
|
};
|
|
3438
3591
|
|
|
3439
3592
|
export { RDSProvider };
|
|
3440
|
-
//# sourceMappingURL=rds-provider-
|
|
3593
|
+
//# sourceMappingURL=rds-provider-CaaoK9Yu.js.map
|