@cdkd/cli 0.340.0 → 0.341.1
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-BAtESAWA.js} +5 -5
- package/dist/{asg-provider-DrQNWTtu.js.map → asg-provider-BAtESAWA.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-DWfH-8xJ.js} +4 -4
- package/dist/{db-instance-modify-retry-BJSwxkSE.js.map → db-instance-modify-retry-DWfH-8xJ.js.map} +1 -1
- package/dist/{deploy-engine-Bn_aBFb7.js → deploy-engine-CGUvIYNR.js} +12501 -12320
- package/dist/deploy-engine-CGUvIYNR.js.map +1 -0
- package/dist/{ecr-uri-B5zqA138.js → ecr-uri-XErmp-WT.js} +3 -3
- package/dist/{ecr-uri-B5zqA138.js.map → ecr-uri-XErmp-WT.js.map} +1 -1
- package/dist/{iam-role-provider-CRHaUz5M.js → iam-role-provider-D9Q0YoPK.js} +5 -5
- package/dist/{iam-role-provider-CRHaUz5M.js.map → iam-role-provider-D9Q0YoPK.js.map} +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -4
- package/dist/{neptune-provider-BL93NXUx.js → neptune-provider-CdvFGM7h.js} +6 -6
- package/dist/{neptune-provider-BL93NXUx.js.map → neptune-provider-CdvFGM7h.js.map} +1 -1
- package/dist/{program-CuJKRAac.js → program-DTlJetBn.js} +180 -45
- package/dist/program-DTlJetBn.js.map +1 -0
- package/dist/{provider-classes-CRZ8a4sy.js → provider-classes-BlYx16N0.js} +282 -153
- package/dist/provider-classes-BlYx16N0.js.map +1 -0
- package/dist/{rds-provider-B-LP69hz.js → rds-provider-Dexme8bI.js} +215 -57
- package/dist/rds-provider-Dexme8bI.js.map +1 -0
- package/dist/{read-replica-DblnJp2B.js → read-replica-BZcBe5RN.js} +3 -3
- package/dist/{read-replica-DblnJp2B.js.map → read-replica-BZcBe5RN.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-B9pb2Csa.js} +2 -2
- package/dist/{version-Y2LIzQUU.js.map → version-B9pb2Csa.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, Jl as acceptedCreateOnlyDropsOf, 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-CGUvIYNR.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-DWfH-8xJ.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-BZcBe5RN.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,66 @@ 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
|
}
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
911
|
+
const RESTORE_SOURCE_KEYS = [
|
|
912
|
+
"SourceDBClusterIdentifier",
|
|
913
|
+
"SourceDbClusterResourceId",
|
|
914
|
+
"SnapshotIdentifier"
|
|
915
|
+
];
|
|
916
|
+
function recordedCreateOnlyDropsOf(context) {
|
|
917
|
+
return acceptedCreateOnlyDropsOf({ acceptedCreateOnlyDrops: context?.recordedCreateOnlyDrops });
|
|
918
|
+
}
|
|
919
|
+
function isRestoredRecord(properties, acceptedDrops) {
|
|
920
|
+
return RESTORE_SOURCE_KEYS.some((key) => {
|
|
921
|
+
if (acceptedDrops.has(key)) return false;
|
|
922
|
+
const source = properties?.[key];
|
|
923
|
+
return typeof source === "string" && source !== "";
|
|
924
|
+
});
|
|
894
925
|
}
|
|
895
926
|
function unusedRestoreKeys(properties, restore) {
|
|
896
|
-
|
|
927
|
+
const pointInTimeKeys = [
|
|
897
928
|
"RestoreType",
|
|
898
929
|
"RestoreToTime",
|
|
899
930
|
"UseLatestRestorableTime"
|
|
900
|
-
]
|
|
901
|
-
|
|
931
|
+
];
|
|
932
|
+
const restoreUnused = [
|
|
902
933
|
"GlobalClusterIdentifier",
|
|
903
934
|
"WithExpressConfiguration",
|
|
904
935
|
"ClusterScalabilityType",
|
|
905
|
-
"MasterUserAuthenticationType"
|
|
936
|
+
"MasterUserAuthenticationType"
|
|
937
|
+
];
|
|
938
|
+
return (restore === void 0 ? pointInTimeKeys : restore.kind === "snapshot" ? [...restoreUnused, ...pointInTimeKeys] : [
|
|
939
|
+
"AvailabilityZones",
|
|
940
|
+
...restoreUnused,
|
|
941
|
+
"SnapshotIdentifier",
|
|
906
942
|
...restore.useLatestRestorableTime === true ? ["RestoreToTime"] : []
|
|
907
943
|
]).filter((key) => {
|
|
908
944
|
const value = properties[key];
|
|
@@ -910,14 +946,18 @@ function unusedRestoreKeys(properties, restore) {
|
|
|
910
946
|
return !(Array.isArray(value) && value.length === 0);
|
|
911
947
|
});
|
|
912
948
|
}
|
|
913
|
-
function restoredDifferences(properties, cluster) {
|
|
914
|
-
return [
|
|
949
|
+
function restoredDifferences(properties, cluster, restore) {
|
|
950
|
+
return (restore.kind === "snapshot" ? [["MasterUsername", cluster.MasterUsername]] : [
|
|
915
951
|
["Engine", cluster.Engine],
|
|
916
952
|
["EngineVersion", cluster.EngineVersion],
|
|
917
953
|
["EngineMode", cluster.EngineMode],
|
|
918
954
|
["MasterUsername", cluster.MasterUsername],
|
|
919
955
|
["DatabaseName", cluster.DatabaseName]
|
|
920
|
-
].filter(([key, live]) =>
|
|
956
|
+
]).filter(([key, live]) => {
|
|
957
|
+
const declared = properties[key];
|
|
958
|
+
const text = typeof declared === "string" || typeof declared === "number" ? String(declared) : "";
|
|
959
|
+
return text !== "" && live !== void 0 && text !== live;
|
|
960
|
+
}).map(([key]) => key);
|
|
921
961
|
}
|
|
922
962
|
const ARN_IDENTIFIER_REFUSALS = /* @__PURE__ */ new Set(["InvalidParameterValue", "InvalidParameterCombination"]);
|
|
923
963
|
async function readRestoreSource(source, resourceType, logicalId, mask) {
|
|
@@ -944,6 +984,69 @@ async function readRestoreSource(source, resourceType, logicalId, mask) {
|
|
|
944
984
|
if (found !== void 0) return found;
|
|
945
985
|
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
986
|
}
|
|
987
|
+
function isLimitlessEngineVersion(engineVersion) {
|
|
988
|
+
return (engineVersion ?? "").split("-")[1] === "limitless";
|
|
989
|
+
}
|
|
990
|
+
async function readRestoreBackup(resourceId, resourceType, logicalId, mask) {
|
|
991
|
+
const refuse = (reason) => {
|
|
992
|
+
throw markNonRetryable(new ProvisioningError(safeMsg`${resourceType} ${logicalId}: ${reason}; nothing was changed.`, resourceType, logicalId));
|
|
993
|
+
};
|
|
994
|
+
let backup;
|
|
995
|
+
try {
|
|
996
|
+
backup = (await this.getClient().send(new DescribeDBClusterAutomatedBackupsCommand({ DbClusterResourceId: resourceId }))).DBClusterAutomatedBackups?.[0];
|
|
997
|
+
} catch (error) {
|
|
998
|
+
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));
|
|
999
|
+
}
|
|
1000
|
+
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`);
|
|
1001
|
+
const limitless = isLimitlessEngineVersion(backup.EngineVersion);
|
|
1002
|
+
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");
|
|
1003
|
+
return {
|
|
1004
|
+
StorageEncrypted: backup.StorageEncrypted,
|
|
1005
|
+
limitless
|
|
1006
|
+
};
|
|
1007
|
+
}
|
|
1008
|
+
const ACCESS_DENIED_CODES = /* @__PURE__ */ new Set([
|
|
1009
|
+
"AccessDenied",
|
|
1010
|
+
"AccessDeniedException",
|
|
1011
|
+
"NotAuthorized",
|
|
1012
|
+
"UnauthorizedOperation"
|
|
1013
|
+
]);
|
|
1014
|
+
const UNREAD_SNAPSHOT = {
|
|
1015
|
+
limitless: false,
|
|
1016
|
+
storageEncrypted: void 0
|
|
1017
|
+
};
|
|
1018
|
+
function snapshotRestoreStaysUnencrypted(properties, source) {
|
|
1019
|
+
const kmsKeyId = properties["KmsKeyId"];
|
|
1020
|
+
const hasKey = typeof kmsKeyId === "string" ? kmsKeyId !== "" : kmsKeyId != null;
|
|
1021
|
+
return source.storageEncrypted === false && coerceCfnBoolean(properties["StorageEncrypted"]) === true && !hasKey;
|
|
1022
|
+
}
|
|
1023
|
+
async function readRestoreSnapshot(snapshotIdentifier, resourceType, logicalId, mask, restoresFromIt = true) {
|
|
1024
|
+
if (/^arn:[^:]*:rds:[^:]*:[^:]*:snapshot[:/]/.test(snapshotIdentifier)) return UNREAD_SNAPSHOT;
|
|
1025
|
+
let found = false;
|
|
1026
|
+
let engineVersion;
|
|
1027
|
+
let storageEncrypted;
|
|
1028
|
+
try {
|
|
1029
|
+
const snapshot = (await this.getClient().send(new DescribeDBClusterSnapshotsCommand({
|
|
1030
|
+
DBClusterSnapshotIdentifier: snapshotIdentifier,
|
|
1031
|
+
IncludeShared: true,
|
|
1032
|
+
IncludePublic: true
|
|
1033
|
+
}))).DBClusterSnapshots?.[0];
|
|
1034
|
+
found = snapshot !== void 0;
|
|
1035
|
+
engineVersion = snapshot?.EngineVersion;
|
|
1036
|
+
storageEncrypted = snapshot?.StorageEncrypted;
|
|
1037
|
+
} catch (error) {
|
|
1038
|
+
if (ACCESS_DENIED_CODES.has(awsErrorName(error))) {
|
|
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.`);
|
|
1040
|
+
return UNREAD_SNAPSHOT;
|
|
1041
|
+
}
|
|
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));
|
|
1043
|
+
}
|
|
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));
|
|
1045
|
+
return {
|
|
1046
|
+
limitless: isLimitlessEngineVersion(engineVersion),
|
|
1047
|
+
storageEncrypted
|
|
1048
|
+
};
|
|
1049
|
+
}
|
|
947
1050
|
function refuseRestoreEncryption(properties, source, resourceType, logicalId) {
|
|
948
1051
|
const desired = coerceCfnBoolean(properties["StorageEncrypted"]);
|
|
949
1052
|
const kmsKeyId = properties["KmsKeyId"];
|
|
@@ -958,19 +1061,13 @@ function refuseRestoreEncryption(properties, source, resourceType, logicalId) {
|
|
|
958
1061
|
function isLimitlessSource(source) {
|
|
959
1062
|
return source.ClusterScalabilityType === "limitless";
|
|
960
1063
|
}
|
|
961
|
-
function
|
|
1064
|
+
function sharedRestoreMembers(properties, tags, logExports) {
|
|
962
1065
|
const string = (key) => properties[key] != null ? properties[key] : void 0;
|
|
963
1066
|
const scaling = properties["ServerlessV2ScalingConfiguration"];
|
|
964
1067
|
const multiAz = clusterCreateMultiAzMembers(properties);
|
|
965
1068
|
const backfill = clusterCreateBackfillMembers(properties);
|
|
966
|
-
const scalars = clusterCreateScalarMembers(properties);
|
|
967
1069
|
const engineLifecycleSupport = engineLifecycleSupportOf(properties);
|
|
968
1070
|
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
1071
|
...backfill.CopyTagsToSnapshot !== void 0 && { CopyTagsToSnapshot: backfill.CopyTagsToSnapshot },
|
|
975
1072
|
...multiAz.DBClusterInstanceClass !== void 0 && { DBClusterInstanceClass: multiAz.DBClusterInstanceClass },
|
|
976
1073
|
...multiAz.Iops !== void 0 && { Iops: multiAz.Iops },
|
|
@@ -984,18 +1081,58 @@ function pointInTimeRestoreInput(properties, restore, dbClusterIdentifier, tags,
|
|
|
984
1081
|
...backfill.StorageType !== void 0 && { StorageType: backfill.StorageType },
|
|
985
1082
|
...properties["VpcSecurityGroupIds"] != null && { VpcSecurityGroupIds: properties["VpcSecurityGroupIds"] },
|
|
986
1083
|
...engineLifecycleSupport !== void 0 && { EngineLifecycleSupport: engineLifecycleSupport },
|
|
987
|
-
...tags.length > 0 && { Tags: tags }
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
}
|
|
1084
|
+
...tags.length > 0 && { Tags: tags }
|
|
1085
|
+
};
|
|
1086
|
+
}
|
|
1087
|
+
function limitlessRestoreMembers(properties) {
|
|
1088
|
+
const scalars = clusterCreateScalarMembers(properties);
|
|
1089
|
+
return {
|
|
1090
|
+
...properties["MonitoringRoleArn"] != null && { MonitoringRoleArn: properties["MonitoringRoleArn"] },
|
|
1091
|
+
...properties["MonitoringInterval"] != null && { MonitoringInterval: Number(properties["MonitoringInterval"]) },
|
|
1092
|
+
...scalars.EnablePerformanceInsights !== void 0 && { EnablePerformanceInsights: scalars.EnablePerformanceInsights },
|
|
1093
|
+
...scalars.PerformanceInsightsRetentionPeriod !== void 0 && { PerformanceInsightsRetentionPeriod: scalars.PerformanceInsightsRetentionPeriod },
|
|
1094
|
+
...scalars.PerformanceInsightsKMSKeyId !== void 0 && { PerformanceInsightsKMSKeyId: scalars.PerformanceInsightsKMSKeyId }
|
|
995
1095
|
};
|
|
996
1096
|
}
|
|
1097
|
+
function definedMembers(members) {
|
|
1098
|
+
return Object.fromEntries(Object.entries(members).filter(([, value]) => value !== void 0));
|
|
1099
|
+
}
|
|
1100
|
+
function pointInTimeRestoreInput(properties, restore, dbClusterIdentifier, tags, logExports, limitless) {
|
|
1101
|
+
return definedMembers({
|
|
1102
|
+
...sharedRestoreMembers(properties, tags, logExports),
|
|
1103
|
+
DBClusterIdentifier: dbClusterIdentifier,
|
|
1104
|
+
...restore.source.by === "identifier" ? { SourceDBClusterIdentifier: restore.source.value } : { SourceDbClusterResourceId: restore.source.value },
|
|
1105
|
+
RestoreType: restore.restoreType,
|
|
1106
|
+
UseLatestRestorableTime: restore.useLatestRestorableTime,
|
|
1107
|
+
RestoreToTime: restore.restoreToTime,
|
|
1108
|
+
...limitless && limitlessRestoreMembers(properties)
|
|
1109
|
+
});
|
|
1110
|
+
}
|
|
1111
|
+
function snapshotRestoreInput(properties, restore, dbClusterIdentifier, tags, logExports, availabilityZones, limitless) {
|
|
1112
|
+
const string = (key) => properties[key] != null ? properties[key] : void 0;
|
|
1113
|
+
const boolean = (key) => properties[key] != null ? properties[key] : void 0;
|
|
1114
|
+
return definedMembers({
|
|
1115
|
+
...sharedRestoreMembers(properties, tags, logExports),
|
|
1116
|
+
DBClusterIdentifier: dbClusterIdentifier,
|
|
1117
|
+
SnapshotIdentifier: restore.snapshotIdentifier,
|
|
1118
|
+
Engine: string("Engine"),
|
|
1119
|
+
EngineVersion: string("EngineVersion"),
|
|
1120
|
+
EngineMode: string("EngineMode"),
|
|
1121
|
+
DatabaseName: string("DatabaseName"),
|
|
1122
|
+
DBClusterParameterGroupName: clusterCreateBackfillMembers(properties).DBClusterParameterGroupName,
|
|
1123
|
+
DeletionProtection: boolean("DeletionProtection"),
|
|
1124
|
+
EnableIAMDatabaseAuthentication: boolean("EnableIAMDatabaseAuthentication"),
|
|
1125
|
+
BacktrackWindow: clusterCreateScalarMembers(properties).BacktrackWindow,
|
|
1126
|
+
...availabilityZones !== void 0 && availabilityZones.length > 0 && { AvailabilityZones: availabilityZones },
|
|
1127
|
+
...limitless && limitlessRestoreMembers(properties)
|
|
1128
|
+
});
|
|
1129
|
+
}
|
|
1130
|
+
async function sendClusterRestore(properties, restore, call) {
|
|
1131
|
+
const { dbClusterIdentifier, tags, logExports, availabilityZones, limitless } = call;
|
|
1132
|
+
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)));
|
|
1133
|
+
}
|
|
997
1134
|
const DEFAULT_BACKUP_RETENTION_PERIOD = 1;
|
|
998
|
-
function
|
|
1135
|
+
function restoreFollowUp(properties, logExports, limitless) {
|
|
999
1136
|
const multiAz = clusterCreateMultiAzMembers(properties);
|
|
1000
1137
|
const backfill = clusterCreateBackfillMembers(properties);
|
|
1001
1138
|
const { EngineLifecycleSupport: _lifecycle, MasterUserAuthenticationType: _authentication, BacktrackWindow: backtrackWindow, ...scalars } = clusterCreateScalarMembers(properties);
|
|
@@ -1082,7 +1219,7 @@ async function createDBCluster(logicalId, resourceType, properties, mask, replay
|
|
|
1082
1219
|
const restore = readClusterRestore(properties, resourceType, logicalId);
|
|
1083
1220
|
const express = expressFlag === true && restore === void 0;
|
|
1084
1221
|
const unused = unusedRestoreKeys(properties, restore);
|
|
1085
|
-
if (unused.length > 0) this.logger.warn(safeMsg`DBCluster ${logicalId}: this ${restore === void 0 ? "create" :
|
|
1222
|
+
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
1223
|
const classSkipped = malformedInstanceClass(properties["DBClusterInstanceClass"]);
|
|
1087
1224
|
const allocatedSkipped = clusterSizeValue(properties["AllocatedStorage"]) === "malformed";
|
|
1088
1225
|
const iopsSkipped = clusterSizeValue(properties["Iops"]) === "malformed";
|
|
@@ -1165,19 +1302,35 @@ async function createDBCluster(logicalId, resourceType, properties, mask, replay
|
|
|
1165
1302
|
const effectiveProperties = skippedKeys.length > 0 ? Object.fromEntries(Object.entries(properties).filter(([key]) => !skippedKeys.includes(key))) : void 0;
|
|
1166
1303
|
const logExports = desiredLogExports(properties, resourceType, logicalId);
|
|
1167
1304
|
const dbClusterIdentifier = properties["DBClusterIdentifier"] || generatedNameFor("AWS::RDS::DBCluster", logicalId, { properties });
|
|
1168
|
-
if (restore !== void 0 &&
|
|
1305
|
+
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
1306
|
let limitless = false;
|
|
1170
|
-
|
|
1171
|
-
|
|
1307
|
+
const declaredSnapshot = properties["SnapshotIdentifier"];
|
|
1308
|
+
if (restore?.kind === "point-in-time" && typeof declaredSnapshot === "string" && declaredSnapshot !== "") await readRestoreSnapshot.call(this, declaredSnapshot, resourceType, logicalId, mask, false);
|
|
1309
|
+
if (restore?.kind === "point-in-time" && restore.source.by === "identifier") {
|
|
1310
|
+
const source = await readRestoreSource.call(this, restore.source.value, resourceType, logicalId, mask);
|
|
1172
1311
|
refuseRestoreEncryption(properties, source, resourceType, logicalId);
|
|
1173
1312
|
limitless = isLimitlessSource(source);
|
|
1313
|
+
} else if (restore?.kind === "point-in-time") {
|
|
1314
|
+
const backup = await readRestoreBackup.call(this, restore.source.value, resourceType, logicalId, mask);
|
|
1315
|
+
refuseRestoreEncryption(properties, backup, resourceType, logicalId);
|
|
1316
|
+
limitless = backup.limitless;
|
|
1317
|
+
} else if (restore?.kind === "snapshot") {
|
|
1318
|
+
const snapshot = await readRestoreSnapshot.call(this, restore.snapshotIdentifier, resourceType, logicalId, mask);
|
|
1319
|
+
limitless = snapshot.limitless;
|
|
1320
|
+
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
1321
|
}
|
|
1175
1322
|
let clusterLeftBehind = false;
|
|
1176
1323
|
let createdResourceId;
|
|
1177
1324
|
try {
|
|
1178
1325
|
const serverlessV2Config = properties["ServerlessV2ScalingConfiguration"];
|
|
1179
1326
|
const masterUserSecret = properties["MasterUserSecret"];
|
|
1180
|
-
const response = await (restore !== void 0 ?
|
|
1327
|
+
const response = await (restore !== void 0 ? sendClusterRestore.call(this, properties, restore, {
|
|
1328
|
+
dbClusterIdentifier,
|
|
1329
|
+
tags,
|
|
1330
|
+
logExports,
|
|
1331
|
+
availabilityZones,
|
|
1332
|
+
limitless
|
|
1333
|
+
}) : this.getCreateClient().send(new CreateDBClusterCommand({
|
|
1181
1334
|
DBClusterIdentifier: dbClusterIdentifier,
|
|
1182
1335
|
Engine: properties["Engine"],
|
|
1183
1336
|
EngineVersion: properties["EngineVersion"],
|
|
@@ -1214,9 +1367,9 @@ async function createDBCluster(logicalId, resourceType, properties, mask, replay
|
|
|
1214
1367
|
createdResourceId = response.DBCluster?.DbClusterResourceId;
|
|
1215
1368
|
reportCreatedResource(logicalId, resourceType, dbClusterIdentifier, createdResourceId);
|
|
1216
1369
|
const cluster = response.DBCluster;
|
|
1217
|
-
if (!cluster) throw new Error(`${restore
|
|
1370
|
+
if (!cluster) throw new Error(`${restoreCallName(restore)} did not return DBCluster`);
|
|
1218
1371
|
if (restore !== void 0) {
|
|
1219
|
-
const differs = restoredDifferences(properties, cluster);
|
|
1372
|
+
const differs = restoredDifferences(properties, cluster, restore);
|
|
1220
1373
|
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
1374
|
}
|
|
1222
1375
|
this.logger.debug(`Successfully created DBCluster ${logicalId}: ${dbClusterIdentifier}`);
|
|
@@ -1224,7 +1377,7 @@ async function createDBCluster(logicalId, resourceType, properties, mask, replay
|
|
|
1224
1377
|
try {
|
|
1225
1378
|
if (restore !== void 0) {
|
|
1226
1379
|
await this.waitForClusterAvailable(logicalId, dbClusterIdentifier, restoreWaitMs(), "being restored");
|
|
1227
|
-
await sendRestoreFollowUp.call(this, logicalId, dbClusterIdentifier,
|
|
1380
|
+
await sendRestoreFollowUp.call(this, logicalId, dbClusterIdentifier, restoreFollowUp(properties, logExports, limitless));
|
|
1228
1381
|
if (httpEndpoint === true && properties["EngineMode"] !== "serverless") {
|
|
1229
1382
|
const arn = cluster.DBClusterArn ?? (await this.describeDBCluster(dbClusterIdentifier))?.DBClusterArn;
|
|
1230
1383
|
if (arn === void 0) throw new Error("The restored DBCluster has no ARN to enable the Data API on");
|
|
@@ -1452,7 +1605,7 @@ async function updateDBCluster(logicalId, physicalId, resourceType, properties,
|
|
|
1452
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`);
|
|
1453
1606
|
skippedKeys.push(["AllocatedStorage", usableClusterSize]);
|
|
1454
1607
|
});
|
|
1455
|
-
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))) {
|
|
1456
1609
|
if (await this.detachFromGlobalCluster(logicalId, physicalId, globalClusterPlan.globalClusterId, {
|
|
1457
1610
|
beforeDelete: false,
|
|
1458
1611
|
removeProtection: false
|
|
@@ -1556,7 +1709,7 @@ async function planGlobalClusterUpdate(physicalId, properties, previousPropertie
|
|
|
1556
1709
|
if (!stateBorne || desiredId === void 0) return { kind: "none" };
|
|
1557
1710
|
const live = await liveGlobalClusterMembership.call(this, physicalId, desiredId);
|
|
1558
1711
|
if (live.kind !== "answered" || live.member) return { kind: "none" };
|
|
1559
|
-
if (isRestoredRecord(previousProperties)) return { kind: "none" };
|
|
1712
|
+
if (isRestoredRecord(previousProperties, recordedCreateOnlyDropsOf(context))) return { kind: "none" };
|
|
1560
1713
|
this.logger.warn(mask(safeMsg`${logicalId} (${resourceType}): the cluster is no longer a member of global cluster ${desiredId}, so the record drops GlobalClusterIdentifier.`));
|
|
1561
1714
|
return { kind: "drop" };
|
|
1562
1715
|
}
|
|
@@ -1611,8 +1764,8 @@ async function liveGlobalClusterMembership(physicalId, desiredId) {
|
|
|
1611
1764
|
};
|
|
1612
1765
|
}
|
|
1613
1766
|
}
|
|
1614
|
-
async function restoredOutsideGlobalCluster(properties, physicalId, globalClusterId) {
|
|
1615
|
-
if (!isRestoredRecord(properties)) return false;
|
|
1767
|
+
async function restoredOutsideGlobalCluster(properties, physicalId, globalClusterId, acceptedDrops) {
|
|
1768
|
+
if (!isRestoredRecord(properties, acceptedDrops)) return false;
|
|
1616
1769
|
const live = await liveGlobalClusterMembership.call(this, physicalId, globalClusterId);
|
|
1617
1770
|
return live.kind === "answered" && !live.member;
|
|
1618
1771
|
}
|
|
@@ -1695,14 +1848,15 @@ async function deleteDBClusterOnce(logicalId, physicalId, resourceType, properti
|
|
|
1695
1848
|
} catch (disableError) {
|
|
1696
1849
|
if (!this.isNotFoundError(disableError, "DBClusterNotFoundFault")) this.logger.debug(maskerOrIdentity(context?.maskSecrets)(`Could not disable deletion protection for DBCluster ${logicalId}: ${describeAwsFailure(disableError).detail}`));
|
|
1697
1850
|
}
|
|
1698
|
-
const
|
|
1851
|
+
const acceptedDrops = recordedCreateOnlyDropsOf(context);
|
|
1852
|
+
const restored = isRestoredRecord(properties, acceptedDrops);
|
|
1699
1853
|
const globalClusterId = recordedGlobalClusterIdentifier(properties);
|
|
1700
|
-
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, {
|
|
1701
1855
|
beforeDelete: true,
|
|
1702
1856
|
removeProtection: context?.removeProtection === true
|
|
1703
1857
|
}, progress, maskerOrIdentity(context?.maskSecrets)) ? globalClusterId : void 0;
|
|
1704
1858
|
const recordedWriterId = recordedExpressWriterId(context?.recordedAttributes);
|
|
1705
|
-
if (!(restored && recordedWriterId === void 0) && expressConfigurationFlag(properties?.["WithExpressConfiguration"]) === true) {
|
|
1859
|
+
if (!(restored && recordedWriterId === void 0) && !acceptedDrops.has("WithExpressConfiguration") && expressConfigurationFlag(properties?.["WithExpressConfiguration"]) === true) {
|
|
1706
1860
|
if (await deleteExpressWriter.call(this, logicalId, physicalId, await this.describeDBCluster(physicalId), recordedWriterId, flip.flippedOffByThisRun, maskerOrIdentity(context?.maskSecrets))) progress.stripped = true;
|
|
1707
1861
|
}
|
|
1708
1862
|
const finalSnapshotId = context?.finalSnapshotIdentifier;
|
|
@@ -2756,6 +2910,8 @@ function getDriftUnknownPaths(resourceType, properties) {
|
|
|
2756
2910
|
"DBInstanceParameterGroupName",
|
|
2757
2911
|
"WithExpressConfiguration",
|
|
2758
2912
|
"SourceDBClusterIdentifier",
|
|
2913
|
+
"SourceDbClusterResourceId",
|
|
2914
|
+
"SnapshotIdentifier",
|
|
2759
2915
|
"RestoreToTime",
|
|
2760
2916
|
"RestoreType",
|
|
2761
2917
|
"UseLatestRestorableTime"
|
|
@@ -3151,6 +3307,8 @@ var RDSProvider = class {
|
|
|
3151
3307
|
"DBInstanceParameterGroupName",
|
|
3152
3308
|
"WithExpressConfiguration",
|
|
3153
3309
|
"SourceDBClusterIdentifier",
|
|
3310
|
+
"SourceDbClusterResourceId",
|
|
3311
|
+
"SnapshotIdentifier",
|
|
3154
3312
|
"RestoreToTime",
|
|
3155
3313
|
"RestoreType",
|
|
3156
3314
|
"UseLatestRestorableTime"
|
|
@@ -3437,4 +3595,4 @@ var RDSProvider = class {
|
|
|
3437
3595
|
};
|
|
3438
3596
|
|
|
3439
3597
|
export { RDSProvider };
|
|
3440
|
-
//# sourceMappingURL=rds-provider-
|
|
3598
|
+
//# sourceMappingURL=rds-provider-Dexme8bI.js.map
|