@cdkd/cli 0.339.0 → 0.340.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.
Files changed (30) hide show
  1. package/dist/{asg-provider-BiLQ0XWy.js → asg-provider-DrQNWTtu.js} +2 -2
  2. package/dist/{asg-provider-BiLQ0XWy.js.map → asg-provider-DrQNWTtu.js.map} +1 -1
  3. package/dist/cli.js +2 -2
  4. package/dist/{db-instance-modify-retry-DR1oW9Ln.js → db-instance-modify-retry-BJSwxkSE.js} +2 -2
  5. package/dist/{db-instance-modify-retry-DR1oW9Ln.js.map → db-instance-modify-retry-BJSwxkSE.js.map} +1 -1
  6. package/dist/{deploy-engine-BFlLAOb5.js → deploy-engine-Bn_aBFb7.js} +99 -35
  7. package/dist/deploy-engine-Bn_aBFb7.js.map +1 -0
  8. package/dist/{ecr-uri-DWcC0h82.js → ecr-uri-B5zqA138.js} +2 -2
  9. package/dist/{ecr-uri-DWcC0h82.js.map → ecr-uri-B5zqA138.js.map} +1 -1
  10. package/dist/{iam-role-provider-m_Kd7_uy.js → iam-role-provider-CRHaUz5M.js} +2 -2
  11. package/dist/{iam-role-provider-m_Kd7_uy.js.map → iam-role-provider-CRHaUz5M.js.map} +1 -1
  12. package/dist/index.d.ts.map +1 -1
  13. package/dist/index.js +2 -2
  14. package/dist/{neptune-provider-Du2C7Q5P.js → neptune-provider-BL93NXUx.js} +3 -3
  15. package/dist/{neptune-provider-Du2C7Q5P.js.map → neptune-provider-BL93NXUx.js.map} +1 -1
  16. package/dist/{program-B-C6eA7H.js → program-CuJKRAac.js} +35 -50
  17. package/dist/program-CuJKRAac.js.map +1 -0
  18. package/dist/{provider-classes-ZB2dhH_W.js → provider-classes-CRZ8a4sy.js} +10 -10
  19. package/dist/provider-classes-CRZ8a4sy.js.map +1 -0
  20. package/dist/{rds-provider-DzsTP_11.js → rds-provider-B-LP69hz.js} +292 -18
  21. package/dist/rds-provider-B-LP69hz.js.map +1 -0
  22. package/dist/{read-replica-DIfL8kl8.js → read-replica-DblnJp2B.js} +2 -2
  23. package/dist/{read-replica-DIfL8kl8.js.map → read-replica-DblnJp2B.js.map} +1 -1
  24. package/dist/{version-eQ4CwKON.js → version-Y2LIzQUU.js} +2 -2
  25. package/dist/{version-eQ4CwKON.js.map → version-Y2LIzQUU.js.map} +1 -1
  26. package/package.json +1 -1
  27. package/dist/deploy-engine-BFlLAOb5.js.map +0 -1
  28. package/dist/program-B-C6eA7H.js.map +0 -1
  29. package/dist/provider-classes-ZB2dhH_W.js.map +0 -1
  30. package/dist/rds-provider-DzsTP_11.js.map +0 -1
@@ -2,12 +2,12 @@ import { $ as safeMsg, n as describeAwsFailure, s as getLogger, y as generatedNa
2
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-D2df_dIB.js";
3
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-DTvJXMeM.js";
4
4
  import { c as ambientRegion } from "./aws-client-defaults-BLXFsfMa.js";
5
- import { $i as refuseMalformedDesiredTags, Ft as enclosingDeadlineRemainingMs, Ji as stringifyIfAssigned, Nc as dbInstanceEngineChangeIsInPlace, Sa as slowCcOperationTimeoutMs, Zi as planTagDiff, qi as definedAttributes, ra as markDeleteStarted, ta as tagPlanWarning, wl as dynamicReferenceTokens } from "./deploy-engine-BFlLAOb5.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-DR1oW9Ln.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-DIfL8kl8.js";
5
+ import { $i as definedAttributes, Al as dynamicReferenceTokens, Ft as enclosingDeadlineRemainingMs, Oa as slowCcOperationTimeoutMs, aa as refuseMalformedDesiredTags, ea as stringifyIfAssigned, la as markDeleteStarted, mi as refuseRestoreFromItself, ra as planTagDiff, sa as tagPlanWarning, ts as coerceCfnBoolean, zc as dbInstanceEngineChangeIsInPlace } from "./deploy-engine-Bn_aBFb7.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-BJSwxkSE.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-DblnJp2B.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, 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";
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,227 @@ async function deleteExpressWriter(logicalId, physicalId, cluster, recordedWrite
834
834
  return true;
835
835
  }
836
836
 
837
+ // src/provisioning/providers/rds/cluster-restore.ts
838
+ 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
+ function parseZonedTimestamp(text) {
840
+ const match = ZONED_DATE_TIME.exec(text);
841
+ if (match === null) return void 0;
842
+ const n = (i) => match[i] === void 0 ? 0 : Number(match[i]);
843
+ const [year, month, day, hour, minute, second] = [
844
+ n(1),
845
+ n(2),
846
+ n(3),
847
+ n(4),
848
+ n(5),
849
+ n(6)
850
+ ];
851
+ const [offsetHours, offsetMinutes, offsetSeconds] = [
852
+ n(9),
853
+ n(10),
854
+ n(11)
855
+ ];
856
+ if (month < 1 || month > 12 || hour > 23 || minute > 59 || second > 59) return void 0;
857
+ if (offsetMinutes > 59 || offsetSeconds > 59) return void 0;
858
+ if (offsetHours * 3600 + offsetMinutes * 60 + offsetSeconds > 64800) return void 0;
859
+ if (day < 1 || new Date(Date.UTC(year, month - 1, day)).getUTCDate() !== day) return void 0;
860
+ const millis = Number((match[7] ?? "").padEnd(3, "0").slice(0, 3));
861
+ const offsetMs = (match[8] === "-" ? -1 : 1) * (offsetHours * 3600 + offsetMinutes * 60 + offsetSeconds) * 1e3;
862
+ const date = new Date(Date.UTC(year, month - 1, day, hour, minute, second, millis) - offsetMs);
863
+ return Number.isNaN(date.getTime()) ? void 0 : date;
864
+ }
865
+ function readClusterRestore(properties, resourceType, logicalId) {
866
+ const refuse = (reason) => {
867
+ throw markNonRetryable(new ProvisioningError(safeMsg`${resourceType} ${logicalId}: ${reason}, as CloudFormation requires; nothing was changed.`, resourceType, logicalId));
868
+ };
869
+ const declaredTime = properties["RestoreToTime"];
870
+ let restoreToTime;
871
+ if (declaredTime != null && !(typeof declaredTime === "string" && declaredTime.trim() === "")) {
872
+ restoreToTime = typeof declaredTime === "string" ? parseZonedTimestamp(declaredTime) : void 0;
873
+ if (restoreToTime === void 0) return refuse("RestoreToTime must be an ISO 8601 timestamp with a time zone, such as 2026-01-01T00:00:00Z");
874
+ }
875
+ const declaredLatest = properties["UseLatestRestorableTime"];
876
+ const useLatestRestorableTime = declaredLatest == null ? void 0 : coerceCfnBoolean(declaredLatest);
877
+ if (declaredLatest != null && useLatestRestorableTime === void 0) return refuse("UseLatestRestorableTime must be true or false");
878
+ const restoreType = properties["RestoreType"];
879
+ if (restoreType != null && typeof restoreType !== "string") return refuse("RestoreType must be a string");
880
+ const source = properties["SourceDBClusterIdentifier"];
881
+ if (source == null) return void 0;
882
+ if (typeof source !== "string") return refuse("SourceDBClusterIdentifier must be a string");
883
+ if (source === "") return void 0;
884
+ return {
885
+ sourceDBClusterIdentifier: source,
886
+ restoreToTime: useLatestRestorableTime === true ? void 0 : restoreToTime,
887
+ useLatestRestorableTime,
888
+ restoreType: restoreType === "" ? void 0 : restoreType
889
+ };
890
+ }
891
+ function isRestoredRecord(properties) {
892
+ const source = properties?.["SourceDBClusterIdentifier"];
893
+ return typeof source === "string" && source !== "";
894
+ }
895
+ function unusedRestoreKeys(properties, restore) {
896
+ return (restore === void 0 ? [
897
+ "RestoreType",
898
+ "RestoreToTime",
899
+ "UseLatestRestorableTime"
900
+ ] : [
901
+ "AvailabilityZones",
902
+ "GlobalClusterIdentifier",
903
+ "WithExpressConfiguration",
904
+ "ClusterScalabilityType",
905
+ "MasterUserAuthenticationType",
906
+ ...restore.useLatestRestorableTime === true ? ["RestoreToTime"] : []
907
+ ]).filter((key) => {
908
+ const value = properties[key];
909
+ if (value == null || value === "" || value === false || value === "false") return false;
910
+ return !(Array.isArray(value) && value.length === 0);
911
+ });
912
+ }
913
+ function restoredDifferences(properties, cluster) {
914
+ return [
915
+ ["Engine", cluster.Engine],
916
+ ["EngineVersion", cluster.EngineVersion],
917
+ ["EngineMode", cluster.EngineMode],
918
+ ["MasterUsername", cluster.MasterUsername],
919
+ ["DatabaseName", cluster.DatabaseName]
920
+ ].filter(([key, live]) => properties[key] != null && properties[key] !== "" && live !== void 0 && String(properties[key]) !== live).map(([key]) => key);
921
+ }
922
+ const ARN_IDENTIFIER_REFUSALS = /* @__PURE__ */ new Set(["InvalidParameterValue", "InvalidParameterCombination"]);
923
+ async function readRestoreSource(source, resourceType, logicalId, mask) {
924
+ 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));
925
+ let found;
926
+ try {
927
+ found = (await this.getClient().send(new DescribeDBClustersCommand({ DBClusterIdentifier: source }))).DBClusters?.[0];
928
+ } catch (error) {
929
+ if (!(source.startsWith("arn:") && error instanceof Error && ARN_IDENTIFIER_REFUSALS.has(error.name)) && !this.isNotFoundError(error, "DBClusterNotFoundFault")) throw wrapSourceReadError(error);
930
+ }
931
+ if (found === void 0 && source.startsWith("arn:")) try {
932
+ let marker;
933
+ do {
934
+ const page = await this.getClient().send(new DescribeDBClustersCommand({
935
+ IncludeShared: true,
936
+ Marker: marker
937
+ }));
938
+ found = page.DBClusters?.find((cluster) => (cluster.DBClusterArn ?? "").toLowerCase() === source.toLowerCase());
939
+ marker = page.Marker;
940
+ } while (found === void 0 && marker !== void 0 && marker !== "");
941
+ } catch (error) {
942
+ throw wrapSourceReadError(error);
943
+ }
944
+ if (found !== void 0) return found;
945
+ 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
+ }
947
+ function refuseRestoreEncryption(properties, source, resourceType, logicalId) {
948
+ const desired = coerceCfnBoolean(properties["StorageEncrypted"]);
949
+ const kmsKeyId = properties["KmsKeyId"];
950
+ const hasKey = typeof kmsKeyId === "string" ? kmsKeyId !== "" : kmsKeyId != null;
951
+ const refuse = (reason) => {
952
+ throw markNonRetryable(new ProvisioningError(`${resourceType} ${logicalId}: ${reason} Nothing was changed.`, resourceType, logicalId));
953
+ };
954
+ 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.");
955
+ 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.");
956
+ 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.");
957
+ }
958
+ function isLimitlessSource(source) {
959
+ return source.ClusterScalabilityType === "limitless";
960
+ }
961
+ function pointInTimeRestoreInput(properties, restore, dbClusterIdentifier, tags, logExports, limitless) {
962
+ const string = (key) => properties[key] != null ? properties[key] : void 0;
963
+ const scaling = properties["ServerlessV2ScalingConfiguration"];
964
+ const multiAz = clusterCreateMultiAzMembers(properties);
965
+ const backfill = clusterCreateBackfillMembers(properties);
966
+ const scalars = clusterCreateScalarMembers(properties);
967
+ const engineLifecycleSupport = engineLifecycleSupportOf(properties);
968
+ 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
+ ...backfill.CopyTagsToSnapshot !== void 0 && { CopyTagsToSnapshot: backfill.CopyTagsToSnapshot },
975
+ ...multiAz.DBClusterInstanceClass !== void 0 && { DBClusterInstanceClass: multiAz.DBClusterInstanceClass },
976
+ ...multiAz.Iops !== void 0 && { Iops: multiAz.Iops },
977
+ ...string("DBSubnetGroupName") !== void 0 && { DBSubnetGroupName: string("DBSubnetGroupName") },
978
+ ...logExports !== void 0 && logExports.length > 0 && { EnableCloudwatchLogsExports: logExports },
979
+ ...string("KmsKeyId") !== void 0 && { KmsKeyId: string("KmsKeyId") },
980
+ ...string("NetworkType") !== void 0 && { NetworkType: string("NetworkType") },
981
+ ...properties["Port"] != null && { Port: Number(properties["Port"]) },
982
+ ...properties["PubliclyAccessible"] != null && { PubliclyAccessible: properties["PubliclyAccessible"] },
983
+ ...scaling != null && { ServerlessV2ScalingConfiguration: serverlessV2ScalingToSend(scaling) },
984
+ ...backfill.StorageType !== void 0 && { StorageType: backfill.StorageType },
985
+ ...properties["VpcSecurityGroupIds"] != null && { VpcSecurityGroupIds: properties["VpcSecurityGroupIds"] },
986
+ ...engineLifecycleSupport !== void 0 && { EngineLifecycleSupport: engineLifecycleSupport },
987
+ ...tags.length > 0 && { Tags: tags },
988
+ ...limitless && {
989
+ ...string("MonitoringRoleArn") !== void 0 && { MonitoringRoleArn: string("MonitoringRoleArn") },
990
+ ...properties["MonitoringInterval"] != null && { MonitoringInterval: Number(properties["MonitoringInterval"]) },
991
+ ...scalars.EnablePerformanceInsights !== void 0 && { EnablePerformanceInsights: scalars.EnablePerformanceInsights },
992
+ ...scalars.PerformanceInsightsRetentionPeriod !== void 0 && { PerformanceInsightsRetentionPeriod: scalars.PerformanceInsightsRetentionPeriod },
993
+ ...scalars.PerformanceInsightsKMSKeyId !== void 0 && { PerformanceInsightsKMSKeyId: scalars.PerformanceInsightsKMSKeyId }
994
+ }
995
+ };
996
+ }
997
+ const DEFAULT_BACKUP_RETENTION_PERIOD = 1;
998
+ function pointInTimeRestoreFollowUp(properties, logExports, limitless) {
999
+ const multiAz = clusterCreateMultiAzMembers(properties);
1000
+ const backfill = clusterCreateBackfillMembers(properties);
1001
+ const { EngineLifecycleSupport: _lifecycle, MasterUserAuthenticationType: _authentication, BacktrackWindow: backtrackWindow, ...scalars } = clusterCreateScalarMembers(properties);
1002
+ const serverlessV1 = properties["EngineMode"] === "serverless";
1003
+ const managed = coerceCfnBoolean(properties["ManageMasterUserPassword"]) === true;
1004
+ const masterUserSecret = properties["MasterUserSecret"];
1005
+ const allocatedStorage = clusterSizeValue(properties["AllocatedStorage"]);
1006
+ const members = {
1007
+ ...scalars,
1008
+ BackupRetentionPeriod: properties["BackupRetentionPeriod"] != null ? Number(properties["BackupRetentionPeriod"]) : DEFAULT_BACKUP_RETENTION_PERIOD,
1009
+ ...logExports !== void 0 && logExports.length > 0 && { CloudwatchLogsExportConfiguration: { EnableLogTypes: logExports } },
1010
+ ...backfill,
1011
+ ...multiAz.DBClusterInstanceClass !== void 0 && { DBClusterInstanceClass: multiAz.DBClusterInstanceClass },
1012
+ ...multiAz.Iops !== void 0 && { Iops: multiAz.Iops },
1013
+ ...properties["DeletionProtection"] != null && { DeletionProtection: properties["DeletionProtection"] },
1014
+ ...properties["MasterUserPassword"] != null && { MasterUserPassword: properties["MasterUserPassword"] },
1015
+ ...properties["MonitoringInterval"] != null && { MonitoringInterval: Number(properties["MonitoringInterval"]) },
1016
+ ...properties["MonitoringRoleArn"] != null && { MonitoringRoleArn: properties["MonitoringRoleArn"] },
1017
+ ...serverlessV1 ? properties["EnableHttpEndpoint"] != null && { EnableHttpEndpoint: coerceCfnBoolean(properties["EnableHttpEndpoint"]) } : {
1018
+ ...typeof allocatedStorage === "number" && { AllocatedStorage: allocatedStorage },
1019
+ ...backtrackWindow !== void 0 && { BacktrackWindow: backtrackWindow },
1020
+ ...properties["EnableIAMDatabaseAuthentication"] != null && { EnableIAMDatabaseAuthentication: properties["EnableIAMDatabaseAuthentication"] }
1021
+ },
1022
+ ...managed && {
1023
+ ManageMasterUserPassword: true,
1024
+ ...masterUserSecret?.KmsKeyId !== void 0 && { MasterUserSecretKmsKeyId: masterUserSecret.KmsKeyId }
1025
+ }
1026
+ };
1027
+ if (serverlessV1) delete members.PreferredBackupWindow;
1028
+ if (limitless) {
1029
+ delete members.StorageType;
1030
+ delete members.EnablePerformanceInsights;
1031
+ delete members.PerformanceInsightsKMSKeyId;
1032
+ delete members.CloudwatchLogsExportConfiguration;
1033
+ }
1034
+ return members;
1035
+ }
1036
+ function restoreWaitMs() {
1037
+ const remaining = enclosingDeadlineRemainingMs() - 3e4;
1038
+ return Number.isFinite(remaining) ? Math.max(18e5, remaining) : 18e5;
1039
+ }
1040
+ async function sendRestoreFollowUp(logicalId, physicalId, members) {
1041
+ await modifyDbInstanceWhenAvailable({
1042
+ send: () => this.getClient().send(new ModifyDBClusterCommand({
1043
+ DBClusterIdentifier: physicalId,
1044
+ ...members,
1045
+ ApplyImmediately: true
1046
+ })),
1047
+ readStatus: async () => (await this.describeDBCluster(physicalId))?.Status,
1048
+ sleep: (ms) => this.sleep(ms),
1049
+ logger: this.logger,
1050
+ label: "DBCluster",
1051
+ subject: "cluster",
1052
+ action: "create",
1053
+ logicalId,
1054
+ remainingMs: enclosingDeadlineRemainingMs()
1055
+ });
1056
+ }
1057
+
837
1058
  // src/provisioning/providers/rds/cluster-create.ts
838
1059
  async function createDBCluster(logicalId, resourceType, properties, mask, replaying = false) {
839
1060
  this.logger.debug(`Creating DBCluster ${logicalId}`);
@@ -858,7 +1079,10 @@ async function createDBCluster(logicalId, resourceType, properties, mask, replay
858
1079
  const globalClusterId = globalClusterSkipped ? void 0 : recordedGlobalClusterIdentifier(properties);
859
1080
  const expressFlag = expressConfigurationFlag(properties["WithExpressConfiguration"]);
860
1081
  const expressSkipped = expressFlag === "malformed";
861
- const express = expressFlag === true;
1082
+ const restore = readClusterRestore(properties, resourceType, logicalId);
1083
+ const express = expressFlag === true && restore === void 0;
1084
+ const unused = unusedRestoreKeys(properties, restore);
1085
+ if (unused.length > 0) this.logger.warn(safeMsg`DBCluster ${logicalId}: this ${restore === void 0 ? "create" : "point-in-time restore"} does not apply ${unused.join(", ")}, as in CloudFormation.`);
862
1086
  const classSkipped = malformedInstanceClass(properties["DBClusterInstanceClass"]);
863
1087
  const allocatedSkipped = clusterSizeValue(properties["AllocatedStorage"]) === "malformed";
864
1088
  const iopsSkipped = clusterSizeValue(properties["Iops"]) === "malformed";
@@ -941,12 +1165,19 @@ async function createDBCluster(logicalId, resourceType, properties, mask, replay
941
1165
  const effectiveProperties = skippedKeys.length > 0 ? Object.fromEntries(Object.entries(properties).filter(([key]) => !skippedKeys.includes(key))) : void 0;
942
1166
  const logExports = desiredLogExports(properties, resourceType, logicalId);
943
1167
  const dbClusterIdentifier = properties["DBClusterIdentifier"] || generatedNameFor("AWS::RDS::DBCluster", logicalId, { properties });
1168
+ if (restore !== void 0 && !/^arn:/i.test(restore.sourceDBClusterIdentifier)) refuseRestoreFromItself(resourceType, properties, dbClusterIdentifier, logicalId, {});
1169
+ let limitless = false;
1170
+ if (restore !== void 0) {
1171
+ const source = await readRestoreSource.call(this, restore.sourceDBClusterIdentifier, resourceType, logicalId, mask);
1172
+ refuseRestoreEncryption(properties, source, resourceType, logicalId);
1173
+ limitless = isLimitlessSource(source);
1174
+ }
944
1175
  let clusterLeftBehind = false;
945
1176
  let createdResourceId;
946
1177
  try {
947
1178
  const serverlessV2Config = properties["ServerlessV2ScalingConfiguration"];
948
1179
  const masterUserSecret = properties["MasterUserSecret"];
949
- const response = await this.getCreateClient().send(new CreateDBClusterCommand({
1180
+ const response = await (restore !== void 0 ? this.getCreateClient().send(new RestoreDBClusterToPointInTimeCommand(pointInTimeRestoreInput(properties, restore, dbClusterIdentifier, tags, logExports, limitless))) : this.getCreateClient().send(new CreateDBClusterCommand({
950
1181
  DBClusterIdentifier: dbClusterIdentifier,
951
1182
  Engine: properties["Engine"],
952
1183
  EngineVersion: properties["EngineVersion"],
@@ -978,16 +1209,31 @@ async function createDBCluster(logicalId, resourceType, properties, mask, replay
978
1209
  ...globalClusterId !== void 0 && { GlobalClusterIdentifier: globalClusterId },
979
1210
  ...expressFlag !== void 0 && !expressSkipped && { WithExpressConfiguration: express },
980
1211
  ...tags.length > 0 && { Tags: tags }
981
- }));
1212
+ })));
982
1213
  clusterLeftBehind = true;
983
1214
  createdResourceId = response.DBCluster?.DbClusterResourceId;
984
1215
  reportCreatedResource(logicalId, resourceType, dbClusterIdentifier, createdResourceId);
985
- if (!response.DBCluster) throw new Error("CreateDBCluster did not return DBCluster");
1216
+ const cluster = response.DBCluster;
1217
+ if (!cluster) throw new Error(`${restore === void 0 ? "CreateDBCluster" : "RestoreDBClusterToPointInTime"} did not return DBCluster`);
1218
+ if (restore !== void 0) {
1219
+ const differs = restoredDifferences(properties, cluster);
1220
+ 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
+ }
986
1222
  this.logger.debug(`Successfully created DBCluster ${logicalId}: ${dbClusterIdentifier}`);
987
1223
  const wantsDeletionProtection = properties["DeletionProtection"] === true;
988
1224
  try {
1225
+ if (restore !== void 0) {
1226
+ await this.waitForClusterAvailable(logicalId, dbClusterIdentifier, restoreWaitMs(), "being restored");
1227
+ await sendRestoreFollowUp.call(this, logicalId, dbClusterIdentifier, pointInTimeRestoreFollowUp(properties, logExports, limitless));
1228
+ if (httpEndpoint === true && properties["EngineMode"] !== "serverless") {
1229
+ const arn = cluster.DBClusterArn ?? (await this.describeDBCluster(dbClusterIdentifier))?.DBClusterArn;
1230
+ if (arn === void 0) throw new Error("The restored DBCluster has no ARN to enable the Data API on");
1231
+ await this.sendHttpEndpointChange(logicalId, dbClusterIdentifier, arn, true);
1232
+ if (process.env["CDKD_NO_WAIT"] !== "true") await this.waitForClusterState(logicalId, dbClusterIdentifier, (live) => live.HttpEndpointEnabled === true, "HTTP endpoint (Data API) setting");
1233
+ }
1234
+ }
989
1235
  if (process.env["CDKD_NO_WAIT"] !== "true") {
990
- await this.waitForClusterAvailable(logicalId, dbClusterIdentifier);
1236
+ await this.waitForClusterAvailable(logicalId, dbClusterIdentifier, restore === void 0 ? void 0 : restoreWaitMs(), restore === void 0 ? void 0 : "applying the restored cluster settings");
991
1237
  if (localWriteForwardingFlag(properties["EnableLocalWriteForwarding"]) === true) await this.waitForClusterState(logicalId, dbClusterIdentifier, (cluster) => localWriteForwardingApplied(cluster, true), "local write forwarding setting");
992
1238
  if (express) await this.waitForInstanceAvailable(logicalId, expressWriterIdentifier(dbClusterIdentifier));
993
1239
  }
@@ -1206,7 +1452,7 @@ async function updateDBCluster(logicalId, physicalId, resourceType, properties,
1206
1452
  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
1453
  skippedKeys.push(["AllocatedStorage", usableClusterSize]);
1208
1454
  });
1209
- if (globalClusterPlan.kind === "detach") {
1455
+ if (globalClusterPlan.kind === "detach" && !await restoredOutsideGlobalCluster.call(this, previousProperties, physicalId, globalClusterPlan.globalClusterId)) {
1210
1456
  if (await this.detachFromGlobalCluster(logicalId, physicalId, globalClusterPlan.globalClusterId, {
1211
1457
  beforeDelete: false,
1212
1458
  removeProtection: false
@@ -1310,6 +1556,7 @@ async function planGlobalClusterUpdate(physicalId, properties, previousPropertie
1310
1556
  if (!stateBorne || desiredId === void 0) return { kind: "none" };
1311
1557
  const live = await liveGlobalClusterMembership.call(this, physicalId, desiredId);
1312
1558
  if (live.kind !== "answered" || live.member) return { kind: "none" };
1559
+ if (isRestoredRecord(previousProperties)) return { kind: "none" };
1313
1560
  this.logger.warn(mask(safeMsg`${logicalId} (${resourceType}): the cluster is no longer a member of global cluster ${desiredId}, so the record drops GlobalClusterIdentifier.`));
1314
1561
  return { kind: "drop" };
1315
1562
  }
@@ -1350,9 +1597,10 @@ async function liveGlobalClusterMembership(physicalId, desiredId) {
1350
1597
  }
1351
1598
  marker = page.Marker;
1352
1599
  } while (marker);
1600
+ const idOf = (id) => id === void 0 ? void 0 : (id.split(":").pop() ?? id).toLowerCase();
1353
1601
  return {
1354
1602
  kind: "answered",
1355
- member: liveId === desiredId
1603
+ member: idOf(liveId) === idOf(desiredId)
1356
1604
  };
1357
1605
  } catch (error) {
1358
1606
  const failure = describeAwsFailure(error);
@@ -1363,6 +1611,11 @@ async function liveGlobalClusterMembership(physicalId, desiredId) {
1363
1611
  };
1364
1612
  }
1365
1613
  }
1614
+ async function restoredOutsideGlobalCluster(properties, physicalId, globalClusterId) {
1615
+ if (!isRestoredRecord(properties)) return false;
1616
+ const live = await liveGlobalClusterMembership.call(this, physicalId, globalClusterId);
1617
+ return live.kind === "answered" && !live.member;
1618
+ }
1366
1619
 
1367
1620
  // src/provisioning/providers/rds/cluster-delete.ts
1368
1621
  async function deleteDBCluster(logicalId, physicalId, resourceType, properties, context) {
@@ -1442,13 +1695,15 @@ async function deleteDBClusterOnce(logicalId, physicalId, resourceType, properti
1442
1695
  } catch (disableError) {
1443
1696
  if (!this.isNotFoundError(disableError, "DBClusterNotFoundFault")) this.logger.debug(maskerOrIdentity(context?.maskSecrets)(`Could not disable deletion protection for DBCluster ${logicalId}: ${describeAwsFailure(disableError).detail}`));
1444
1697
  }
1698
+ const restored = isRestoredRecord(properties);
1445
1699
  const globalClusterId = recordedGlobalClusterIdentifier(properties);
1446
- if (globalClusterId !== void 0) detachedFrom = await this.detachFromGlobalCluster(logicalId, physicalId, globalClusterId, {
1700
+ if (globalClusterId !== void 0 && !await restoredOutsideGlobalCluster.call(this, properties, physicalId, globalClusterId)) detachedFrom = await this.detachFromGlobalCluster(logicalId, physicalId, globalClusterId, {
1447
1701
  beforeDelete: true,
1448
1702
  removeProtection: context?.removeProtection === true
1449
1703
  }, progress, maskerOrIdentity(context?.maskSecrets)) ? globalClusterId : void 0;
1450
- if (expressConfigurationFlag(properties?.["WithExpressConfiguration"]) === true) {
1451
- if (await deleteExpressWriter.call(this, logicalId, physicalId, await this.describeDBCluster(physicalId), recordedExpressWriterId(context?.recordedAttributes), flip.flippedOffByThisRun, maskerOrIdentity(context?.maskSecrets))) progress.stripped = true;
1704
+ const recordedWriterId = recordedExpressWriterId(context?.recordedAttributes);
1705
+ if (!(restored && recordedWriterId === void 0) && expressConfigurationFlag(properties?.["WithExpressConfiguration"]) === true) {
1706
+ if (await deleteExpressWriter.call(this, logicalId, physicalId, await this.describeDBCluster(physicalId), recordedWriterId, flip.flippedOffByThisRun, maskerOrIdentity(context?.maskSecrets))) progress.stripped = true;
1452
1707
  }
1453
1708
  const finalSnapshotId = context?.finalSnapshotIdentifier;
1454
1709
  const sendDelete = () => this.getClient().send(new DeleteDBClusterCommand({
@@ -1878,6 +2133,9 @@ async function createDBInstance(logicalId, resourceType, properties, mask, repla
1878
2133
  ...logExports !== void 0 && logExports.length > 0 && { EnableCloudwatchLogsExports: logExports },
1879
2134
  ...properties["DBName"] != null && { DBName: properties["DBName"] },
1880
2135
  ...properties["AvailabilityZone"] != null && { AvailabilityZone: properties["AvailabilityZone"] },
2136
+ ...properties["CharacterSetName"] != null && { CharacterSetName: properties["CharacterSetName"] },
2137
+ ...properties["NcharCharacterSetName"] != null && { NcharCharacterSetName: properties["NcharCharacterSetName"] },
2138
+ ...properties["Timezone"] != null && { Timezone: properties["Timezone"] },
1881
2139
  ...processor.features !== void 0 && { ProcessorFeatures: processor.features },
1882
2140
  ...tags.length > 0 && { Tags: tags }
1883
2141
  });
@@ -2496,7 +2754,11 @@ function getDriftUnknownPaths(resourceType, properties) {
2496
2754
  "MasterUserAuthenticationType",
2497
2755
  "GlobalClusterIdentifier",
2498
2756
  "DBInstanceParameterGroupName",
2499
- "WithExpressConfiguration"
2757
+ "WithExpressConfiguration",
2758
+ "SourceDBClusterIdentifier",
2759
+ "RestoreToTime",
2760
+ "RestoreType",
2761
+ "UseLatestRestorableTime"
2500
2762
  ];
2501
2763
  if (properties === void 0 || Object.keys(properties).length === 0) return neverRead;
2502
2764
  return (properties?.["ServerlessV2ScalingConfiguration"])?.SecondsUntilAutoPause === void 0 ? [...neverRead, "ServerlessV2ScalingConfiguration.SecondsUntilAutoPause"] : neverRead;
@@ -2705,6 +2967,11 @@ async function readCurrentStateDBInstance(physicalId) {
2705
2967
  }
2706
2968
  if (inst.DBName !== void 0) result["DBName"] = inst.DBName;
2707
2969
  if (inst.AvailabilityZone !== void 0 && inst.MultiAZ !== true) result["AvailabilityZone"] = inst.AvailabilityZone;
2970
+ for (const key of [
2971
+ "CharacterSetName",
2972
+ "NcharCharacterSetName",
2973
+ "Timezone"
2974
+ ]) if (inst[key] !== void 0) result[key] = inst[key];
2708
2975
  if (inst.EngineLifecycleSupport !== void 0 && inst.DBClusterIdentifier === void 0) result["EngineLifecycleSupport"] = inst.EngineLifecycleSupport;
2709
2976
  const liveSource = inst.ReadReplicaSourceDBInstanceIdentifier;
2710
2977
  if (liveSource !== void 0 && liveSource !== "") {
@@ -2882,7 +3149,11 @@ var RDSProvider = class {
2882
3149
  "AllocatedStorage",
2883
3150
  "Iops",
2884
3151
  "DBInstanceParameterGroupName",
2885
- "WithExpressConfiguration"
3152
+ "WithExpressConfiguration",
3153
+ "SourceDBClusterIdentifier",
3154
+ "RestoreToTime",
3155
+ "RestoreType",
3156
+ "UseLatestRestorableTime"
2886
3157
  ])],
2887
3158
  ["AWS::RDS::DBInstance", /* @__PURE__ */ new Set([
2888
3159
  "DBInstanceIdentifier",
@@ -2941,7 +3212,10 @@ var RDSProvider = class {
2941
3212
  "UseDefaultProcessorFeatures",
2942
3213
  "AutomaticBackupReplicationRegion",
2943
3214
  "AutomaticBackupReplicationKmsKeyId",
2944
- "AutomaticBackupReplicationRetentionPeriod"
3215
+ "AutomaticBackupReplicationRetentionPeriod",
3216
+ "CharacterSetName",
3217
+ "NcharCharacterSetName",
3218
+ "Timezone"
2945
3219
  ])]
2946
3220
  ]);
2947
3221
  unhandledByDesign = /* @__PURE__ */ new Map([["AWS::RDS::DBCluster", /* @__PURE__ */ new Map([
@@ -3163,4 +3437,4 @@ var RDSProvider = class {
3163
3437
  };
3164
3438
 
3165
3439
  export { RDSProvider };
3166
- //# sourceMappingURL=rds-provider-DzsTP_11.js.map
3440
+ //# sourceMappingURL=rds-provider-B-LP69hz.js.map