@cdkd/cli 0.347.0 → 0.348.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 (37) hide show
  1. package/dist/{ambient-client-defaults-BV_xDm4m.js → ambient-client-defaults-7acjxfyN.js} +3 -3
  2. package/dist/{ambient-client-defaults-BV_xDm4m.js.map → ambient-client-defaults-7acjxfyN.js.map} +1 -1
  3. package/dist/{asg-provider-fpr4ZEfp.js → asg-provider-r1ojkIvF.js} +5 -5
  4. package/dist/{asg-provider-fpr4ZEfp.js.map → asg-provider-r1ojkIvF.js.map} +1 -1
  5. package/dist/cli.js +2 -2
  6. package/dist/{db-instance-modify-retry-BbBT68Qa.js → db-instance-modify-retry-BaSXzEMy.js} +4 -4
  7. package/dist/{db-instance-modify-retry-BbBT68Qa.js.map → db-instance-modify-retry-BaSXzEMy.js.map} +1 -1
  8. package/dist/{deploy-engine-DMWjQ_C2.js → deploy-engine-2XoVAu4C.js} +209 -42
  9. package/dist/deploy-engine-2XoVAu4C.js.map +1 -0
  10. package/dist/{ecr-uri-C2FWGsrX.js → ecr-uri-C1_heDAt.js} +3 -3
  11. package/dist/{ecr-uri-C2FWGsrX.js.map → ecr-uri-C1_heDAt.js.map} +1 -1
  12. package/dist/{iam-role-provider-70-NzlFV.js → iam-role-provider-BnLtoKcW.js} +5 -5
  13. package/dist/{iam-role-provider-70-NzlFV.js.map → iam-role-provider-BnLtoKcW.js.map} +1 -1
  14. package/dist/index.d.ts.map +1 -1
  15. package/dist/index.js +4 -4
  16. package/dist/{aws-failure-text-jomzO3aT.js → logger-DmQRya0S.js} +148 -59
  17. package/dist/logger-DmQRya0S.js.map +1 -0
  18. package/dist/{neptune-provider-CX4BHKjZ.js → neptune-provider-lzti8HIF.js} +6 -6
  19. package/dist/{neptune-provider-CX4BHKjZ.js.map → neptune-provider-lzti8HIF.js.map} +1 -1
  20. package/dist/{program-BU5T28eB.js → program-DSlYCm_d.js} +408 -151
  21. package/dist/program-DSlYCm_d.js.map +1 -0
  22. package/dist/{provider-classes-cw32hLq9.js → provider-classes-RMTfwJPz.js} +19 -19
  23. package/dist/provider-classes-RMTfwJPz.js.map +1 -0
  24. package/dist/{rds-provider-CxSVX1d7.js → rds-provider-COq1pW0G.js} +52 -34
  25. package/dist/{rds-provider-CxSVX1d7.js.map → rds-provider-COq1pW0G.js.map} +1 -1
  26. package/dist/{read-replica-DtD9IDko.js → read-replica-sjvqi8Of.js} +78 -24
  27. package/dist/read-replica-sjvqi8Of.js.map +1 -0
  28. package/dist/{update-removal-CpGaCv-d.js → update-removal-D-FspP88.js} +3 -3
  29. package/dist/{update-removal-CpGaCv-d.js.map → update-removal-D-FspP88.js.map} +1 -1
  30. package/dist/{version-Bx-Ox9xU.js → version-DXmr3_M4.js} +2 -2
  31. package/dist/{version-Bx-Ox9xU.js.map → version-DXmr3_M4.js.map} +1 -1
  32. package/package.json +3 -2
  33. package/dist/aws-failure-text-jomzO3aT.js.map +0 -1
  34. package/dist/deploy-engine-DMWjQ_C2.js.map +0 -1
  35. package/dist/program-BU5T28eB.js.map +0 -1
  36. package/dist/provider-classes-cw32hLq9.js.map +0 -1
  37. package/dist/read-replica-DtD9IDko.js.map +0 -1
@@ -1,10 +1,10 @@
1
- import { S as coerceCfnBoolean, b as generatedNameFor, n as describeAwsFailure, s as getLogger, ut as safeMsg } from "./aws-failure-text-jomzO3aT.js";
2
- import { G as markRedactedCause, K as wrapMaskedAwsError, O as relayedNameCollision, W as markNonRetryable, _ as ResourceUpdateNotSupportedError, at as ProvisioningError, et as CdkdError, t as ambientClientDefaults } from "./ambient-client-defaults-BV_xDm4m.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-CpGaCv-d.js";
1
+ import { E as coerceCfnBoolean, mt as safeMsg, n as getLogger, u as describeAwsFailure, w as generatedNameFor } from "./logger-DmQRya0S.js";
2
+ import { G as markRedactedCause, K as wrapMaskedAwsError, O as relayedNameCollision, W as markNonRetryable, _ as ResourceUpdateNotSupportedError, at as ProvisioningError, et as CdkdError, t as ambientClientDefaults } from "./ambient-client-defaults-7acjxfyN.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-D-FspP88.js";
4
4
  import { f as ambientRegion } from "./aws-client-defaults-DAebi99J.js";
5
- import { El as dynamicReferenceTokens, Ic as dbInstanceEngineChangeIsInPlace, Na as slowCcOperationTimeoutMs, Ql as acceptedCreateOnlyDropsOf, _i as pointInTimeTemplateRefusal, aa as stringifyIfAssigned, ca as planTagDiff, fa as tagPlanWarning, gi as declaresInstancePointInTime, hi as POINT_IN_TIME_NO_SOURCE_REASON, ia as definedAttributes, jt as enclosingDeadlineRemainingMs, ma as markDeleteStarted, ua as refuseMalformedDesiredTags, vi as refuseRestoreFromItself, yi as parseZonedTimestamp } from "./deploy-engine-DMWjQ_C2.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-BbBT68Qa.js";
7
- import { a as positive, c as refuseUnknownSourceRegion, d as replicaModifyAfterCreateInput, f as replicaNeedsModifyAfterCreate, g as withPreviousReplicaSource, h as sameReplicaSource, i as ownScopeOf, l as replicaCreateInput, m as replicaSourceOf, n as describeReplicaSource, p as replicaSourceChange, r as isLiveReadReplica, s as refuseMalformedReplicaSource, t as declared, u as replicaEngine } from "./read-replica-DtD9IDko.js";
5
+ import { El as dynamicReferenceTokens, Ic as dbInstanceEngineChangeIsInPlace, Na as slowCcOperationTimeoutMs, Ql as acceptedCreateOnlyDropsOf, _i as pointInTimeTemplateRefusal, aa as stringifyIfAssigned, ca as planTagDiff, fa as tagPlanWarning, gi as declaresInstancePointInTime, hi as POINT_IN_TIME_NO_SOURCE_REASON, ia as definedAttributes, jt as enclosingDeadlineRemainingMs, ma as markDeleteStarted, ua as refuseMalformedDesiredTags, vi as refuseRestoreFromItself, yi as parseZonedTimestamp } from "./deploy-engine-2XoVAu4C.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-BaSXzEMy.js";
7
+ import { _ as replicaSourceChange, a as isLiveReadReplica, b as withPreviousReplicaSource, c as positive, d as refuseMalformedReplicaSource, f as refuseUnknownSourceRegion, g as replicaNeedsModifyAfterCreate, h as replicaModifyAfterCreateInput, i as describeReplicaSource, m as replicaEngine, n as declared, o as liveReplicaSource, p as replicaCreateInput, r as declaredReplicaSource, s as ownScopeOf, t as REPLICA_SOURCE_KEYS, u as refuseBothReplicaSources, v as replicaSourceStatus, y as sameReplicaSource } from "./read-replica-sjvqi8Of.js";
8
8
  import { DescribeSecurityGroupsCommand, EC2Client } from "@aws-sdk/client-ec2";
9
9
  import { isDeepStrictEqual } from "node:util";
10
10
  import { AddRoleToDBClusterCommand, AddRoleToDBInstanceCommand, AddTagsToResourceCommand, CreateDBClusterCommand, CreateDBInstanceCommand, CreateDBInstanceReadReplicaCommand, CreateDBSubnetGroupCommand, DeleteDBClusterCommand, DeleteDBInstanceCommand, DeleteDBSubnetGroupCommand, DescribeDBClusterAutomatedBackupsCommand, DescribeDBClusterSnapshotsCommand, DescribeDBClustersCommand, DescribeDBInstanceAutomatedBackupsCommand, DescribeDBInstancesCommand, DescribeDBSnapshotsCommand, DescribeDBSubnetGroupsCommand, DescribeGlobalClustersCommand, DisableHttpEndpointCommand, EnableHttpEndpointCommand, ListTagsForResourceCommand, ModifyDBClusterCommand, ModifyDBInstanceCommand, ModifyDBSubnetGroupCommand, PromoteReadReplicaCommand, RDSClient, RebootDBInstanceCommand, RemoveFromGlobalClusterCommand, RemoveRoleFromDBClusterCommand, RemoveRoleFromDBInstanceCommand, RemoveTagsFromResourceCommand, RestoreDBClusterFromSnapshotCommand, RestoreDBClusterToPointInTimeCommand, RestoreDBInstanceFromDBSnapshotCommand, RestoreDBInstanceToPointInTimeCommand, StartDBInstanceAutomatedBackupsReplicationCommand, StopDBInstanceAutomatedBackupsReplicationCommand } from "@aws-sdk/client-rds";
@@ -2772,7 +2772,8 @@ function unusedPointInTimeRestoreKeys(properties) {
2772
2772
  "AdditionalStorageVolumes",
2773
2773
  "DBClusterIdentifier",
2774
2774
  "PromotionTier",
2775
- "MasterUserAuthenticationType"
2775
+ "MasterUserAuthenticationType",
2776
+ "SourceDBClusterIdentifier"
2776
2777
  ].filter((key) => {
2777
2778
  const value = properties[key];
2778
2779
  if (value == null || value === "") return false;
@@ -2811,9 +2812,10 @@ async function createDBInstance(logicalId, resourceType, properties, mask, repla
2811
2812
  refuseMalformedReplicaSource(properties, resourceType, logicalId);
2812
2813
  refuseUnknownSourceRegion(properties, resourceType, logicalId, replaying, (message) => this.logger.warn(message));
2813
2814
  const pointInTime = readInstancePointInTimeRestore(properties, resourceType, logicalId);
2814
- const replicaSource = pointInTime === void 0 ? replicaSourceOf(properties) : void 0;
2815
+ if (pointInTime === void 0) refuseBothReplicaSources(properties, resourceType, logicalId);
2816
+ const replicaSource = pointInTime === void 0 ? declaredReplicaSource(properties) : void 0;
2815
2817
  const snapshotRestore = pointInTime === void 0 && replicaSource === void 0 ? readInstanceSnapshotRestore(properties, resourceType, logicalId) : void 0;
2816
- if (snapshotRestore === void 0 && declaredSnapshotKeys(properties).length > 0) this.logger.warn(pointInTime !== void 0 ? safeMsg`DBInstance ${logicalId}: ${declaredSnapshotKeys(properties).join(", ")} not applied: a point-in-time key makes the create a restore to a point in time, which reads no snapshot, as in CloudFormation.` : safeMsg`DBInstance ${logicalId}: ${declaredSnapshotKeys(properties).join(", ")} not applied: SourceDBInstanceIdentifier makes the instance a read replica, which restores no snapshot, as in CloudFormation.`);
2818
+ if (snapshotRestore === void 0 && declaredSnapshotKeys(properties).length > 0) this.logger.warn(pointInTime !== void 0 ? safeMsg`DBInstance ${logicalId}: ${declaredSnapshotKeys(properties).join(", ")} not applied: a point-in-time key makes the create a restore to a point in time, which reads no snapshot, as in CloudFormation.` : safeMsg`DBInstance ${logicalId}: ${declaredSnapshotKeys(properties).join(", ")} not applied: ${replicaSource?.key ?? "SourceDBInstanceIdentifier"} makes the instance a read replica, which restores no snapshot, as in CloudFormation.`);
2817
2819
  const dbInstanceIdentifier = properties["DBInstanceIdentifier"] || generatedNameFor("AWS::RDS::DBInstance", logicalId);
2818
2820
  if (snapshotRestore !== void 0 || pointInTime !== void 0) refuseRestoreFromItself(resourceType, properties, dbInstanceIdentifier, logicalId, {});
2819
2821
  let instanceCreated = false;
@@ -2970,14 +2972,14 @@ async function createReadReplicaWhenSourceAvailable(logicalId, source, command)
2970
2972
  send: async () => {
2971
2973
  response = await this.getCreateClient().send(command);
2972
2974
  },
2973
- readStatus: async () => (await describeReplicaSource.call(this, source))?.DBInstanceStatus,
2975
+ readStatus: () => replicaSourceStatus.call(this, source),
2974
2976
  sleep: (ms) => this.sleep(ms),
2975
2977
  logger: this.logger,
2976
2978
  label: "RDS DBInstance",
2977
2979
  logicalId,
2978
2980
  remainingMs: enclosingDeadlineRemainingMs(),
2979
2981
  action: "create of the read replica",
2980
- nounText: "source instance"
2982
+ nounText: source.key === "SourceDBClusterIdentifier" ? "source DB cluster" : "source instance"
2981
2983
  });
2982
2984
  return response;
2983
2985
  }
@@ -3002,11 +3004,15 @@ async function updateDBInstance(logicalId, physicalId, resourceType, properties,
3002
3004
  }
3003
3005
  if (passwordCompanion?.kind === "missing") throw markNonRetryable(new ProvisioningError(passwordAuthenticationMissingText(resourceType, logicalId), resourceType, logicalId, physicalId));
3004
3006
  refuseMalformedReplicaSource(properties, resourceType, logicalId, physicalId);
3005
- const sourceChange = declaresPointInTimeRestore(previousProperties) || declaresPointInTimeRestore(properties) ? "unchanged" : replicaSourceChange(properties, previousProperties);
3007
+ const sourceChange = declaresPointInTimeRestore(previousProperties) || declaresPointInTimeRestore(properties) ? {
3008
+ kind: "unchanged",
3009
+ keys: [],
3010
+ removed: []
3011
+ } : replicaSourceChange(properties, previousProperties);
3006
3012
  const restoreKeys = [
3007
3013
  ...SNAPSHOT_RESTORE_KEYS,
3008
3014
  ...POINT_IN_TIME_KEYS,
3009
- ...declaresPointInTimeRestore(previousProperties) ? ["SourceDBInstanceIdentifier"] : []
3015
+ ...declaresPointInTimeRestore(previousProperties) ? ["SourceDBInstanceIdentifier", "SourceDBClusterIdentifier"] : []
3010
3016
  ];
3011
3017
  const changedRestoreKeys = changedCreateTimeKeys(restoreKeys, properties, previousProperties, context?.changedProperties, context?.noEchoOnlyChangedProperties);
3012
3018
  const unconfirmedRestoreKeys = unconfirmedCreateTimeKeys(restoreKeys, properties, previousProperties, context?.noEchoOnlyChangedProperties);
@@ -3033,7 +3039,7 @@ async function updateDBInstance(logicalId, physicalId, resourceType, properties,
3033
3039
  fromReadback: context?.desiredFromAwsReadback === true
3034
3040
  }, resourceType, logicalId, physicalId, (message) => this.logger.warn(message));
3035
3041
  const { mask: sourceMask } = withDerivedNameMasks(this.logger, createMaskedLogSinks(this.logger, context?.maskSecrets), [[previousProperties["DBInstanceIdentifier"], physicalId]]);
3036
- let sourceKept = sourceChange !== "immutable";
3042
+ let sourceKept = sourceChange.kind !== "immutable";
3037
3043
  let liveSourceRead = "read";
3038
3044
  if (!sourceKept) {
3039
3045
  const live = await this.describeDBInstance(physicalId).then((instance) => {
@@ -3043,12 +3049,15 @@ async function updateDBInstance(logicalId, physicalId, resourceType, properties,
3043
3049
  liveSourceRead = err?.name === "DBInstanceNotFoundFault" ? "not-found" : "unreadable";
3044
3050
  this.logger.debug(sourceMask(safeMsg`DBInstance ${logicalId}: could not read the live replica source: ${describeAwsFailure(err).summary}`));
3045
3051
  });
3046
- const liveSource = live?.ReadReplicaSourceDBInstanceIdentifier;
3047
- const desiredSource = replicaSourceOf(properties);
3048
- sourceKept = liveSource !== void 0 && liveSource !== "" && desiredSource !== void 0 && sameReplicaSource(liveSource, desiredSource, ownScopeOf(live?.DBInstanceArn));
3052
+ sourceKept = sourceChange.keys.every((key) => {
3053
+ const liveSource = liveReplicaSource(live, key);
3054
+ const desiredSource = properties[key];
3055
+ return liveSource !== void 0 && typeof desiredSource === "string" && desiredSource !== "" && sameReplicaSource(liveSource, desiredSource, ownScopeOf(live?.DBInstanceArn));
3056
+ });
3049
3057
  }
3058
+ const sourceKeys = sourceChange.keys.join(" and ");
3050
3059
  const stateBorne = context?.replayingState === true || context?.desiredFromAwsReadback === true;
3051
- if (!sourceKept && !stateBorne) throw new ResourceUpdateNotSupportedError(resourceType, logicalId, sourceMask(`SourceDBInstanceIdentifier cannot be added or changed on an existing DB instance — an instance becomes a read replica only when it is created, and CloudFormation refuses the same update ("Resource is immutable"). Removing it promotes the replica instead. Nothing was applied to DB instance ${physicalId}. ` + (liveSourceRead === "not-found" ? "RDS reports no such DB instance: it was deleted outside cdkd, so the state record no longer matches AWS. " : liveSourceRead === "unreadable" ? "cdkd could not read the instance's live replica source (an AWS read failed), so it could not tell whether the instance already replicates the declared source; a re-run may succeed. " : "") + "To keep the instance as it is, declare the source the previous deploy declared (or none, if it declared none). To replace it with a new read replica, " + (String(previousProperties["DeletionProtection"]) === "true" ? protectedReplacementAdvice({
3060
+ if (!sourceKept && !stateBorne) throw new ResourceUpdateNotSupportedError(resourceType, logicalId, sourceMask(`${sourceKeys} cannot be added or changed on an existing DB instance — an instance becomes a read replica only when it is created, and CloudFormation refuses the same update ("Resource is immutable"). Removing it promotes the replica instead` + (sourceChange.removed.length > 0 ? ` (here it replaces ${sourceChange.removed.join(" and ")}, so nothing is promoted)` : "") + `. Nothing was applied to DB instance ${physicalId}. ` + (liveSourceRead === "not-found" ? "RDS reports no such DB instance: it was deleted outside cdkd, so the state record no longer matches AWS. " : liveSourceRead === "unreadable" ? "cdkd could not read the instance's live replica source (an AWS read failed), so it could not tell whether the instance already replicates the declared source; a re-run may succeed. " : "") + "To keep the instance as it is, declare the source the previous deploy declared (or none, if it declared none). To replace it with a new read replica, " + (String(previousProperties["DeletionProtection"]) === "true" ? protectedReplacementAdvice({
3052
3061
  evidence: "cdkd's properties for this DB instance carry DeletionProtection: true",
3053
3062
  replaceFlags: "cdkd deploy --replace --force-stateful-recreation",
3054
3063
  disable: {
@@ -3058,7 +3067,7 @@ async function updateDBInstance(logicalId, physicalId, resourceType, properties,
3058
3067
  maskSecrets: sourceMask
3059
3068
  }
3060
3069
  }) : "note AWS::RDS::DBInstance is a stateful type: re-run with cdkd deploy --replace --force-stateful-recreation (this deletes the instance and its data). The replace flags apply to the WHOLE deploy, so run them with nothing else pending")));
3061
- if (!sourceKept) this.logger.warn(sourceMask(safeMsg`DBInstance ${logicalId} (${physicalId}): SourceDBInstanceIdentifier cannot be ` + safeMsg`added or changed in place (an instance becomes a read replica only when it is ` + safeMsg`created), so the instance keeps its current replication and cdkd records that.`));
3070
+ if (!sourceKept) this.logger.warn(sourceMask(safeMsg`DBInstance ${logicalId} (${physicalId}): ${sourceKeys} cannot be ` + safeMsg`added or changed in place (an instance becomes a read replica only when it is ` + safeMsg`created), so the instance keeps its current replication and cdkd records that.`));
3062
3071
  const { mask: zoneMask } = withDerivedNameMasks(this.logger, createMaskedLogSinks(this.logger, context?.maskSecrets), [[previousProperties["DBInstanceIdentifier"], physicalId]]);
3063
3072
  const desiredZone = properties["AvailabilityZone"];
3064
3073
  let zoneKept = context?.desiredFromAwsReadback === true || context?.replayingState === true && (desiredZone == null || desiredZone === "") || instanceAvailabilityZoneKept(properties, previousProperties);
@@ -3082,13 +3091,13 @@ async function updateDBInstance(logicalId, physicalId, resourceType, properties,
3082
3091
  }) : "note AWS::RDS::DBInstance is a stateful type: re-run with cdkd deploy --replace --force-stateful-recreation to recreate it in the new zone (this deletes the instance and its data)")));
3083
3092
  if (!zoneKept) this.logger.warn(zoneMask(safeMsg`DBInstance ${logicalId} (${physicalId}): AvailabilityZone cannot change in place ` + safeMsg`(ModifyDBInstance has no such member), so the instance keeps its current zone ` + safeMsg`and cdkd records that zone.`));
3084
3093
  let promotionSkipped = false;
3085
- if (sourceChange === "promote") {
3094
+ if (sourceChange.kind === "promote") {
3086
3095
  const live = await this.describeDBInstance(physicalId);
3087
3096
  if (isLiveReadReplica(live) && context?.replayingState === true) {
3088
3097
  promotionSkipped = true;
3089
3098
  this.logger.warn(sourceMask(safeMsg`DBInstance ${logicalId} (${physicalId}): the rollback does not promote the read replica (a promotion cannot be undone, and the instance was a replica before this deploy), so cdkd records its source.`));
3090
3099
  } else if (isLiveReadReplica(live)) {
3091
- this.logger.info(safeMsg`Promoting DBInstance ${logicalId} to a standalone instance (SourceDBInstanceIdentifier was removed), as CloudFormation does`);
3100
+ this.logger.info(safeMsg`Promoting DBInstance ${logicalId} to a standalone instance (${sourceKeys} was removed), as CloudFormation does`);
3092
3101
  await this.getClient().send(new PromoteReadReplicaCommand({
3093
3102
  DBInstanceIdentifier: physicalId,
3094
3103
  ...properties["BackupRetentionPeriod"] != null && { BackupRetentionPeriod: Number(properties["BackupRetentionPeriod"]) },
@@ -3242,7 +3251,7 @@ async function deleteDBInstanceOnce(logicalId, physicalId, resourceType, propert
3242
3251
  if (!this.isNotFoundError(disableError, "DBInstanceNotFoundFault")) this.logger.debug(maskerOrIdentity(context?.maskSecrets)(`Could not disable deletion protection for DBInstance ${logicalId}: ${describeAwsFailure(disableError).detail}`));
3243
3252
  }
3244
3253
  let finalSnapshotId = properties?.["DBClusterIdentifier"] === void 0 ? context?.finalSnapshotIdentifier : void 0;
3245
- if (finalSnapshotId && replicaSourceOf(properties) !== void 0) {
3254
+ if (finalSnapshotId && declaredReplicaSource(properties) !== void 0) {
3246
3255
  const live = await this.describeDBInstance(physicalId).catch((err) => {
3247
3256
  this.logger.debug(maskerOrIdentity(context?.maskSecrets)(safeMsg`Could not read whether DBInstance ${logicalId} is a read replica: ${describeAwsFailure(err).detail}`));
3248
3257
  });
@@ -3538,7 +3547,7 @@ function getDriftUnknownPaths(resourceType, properties) {
3538
3547
  "DBSnapshotIdentifier",
3539
3548
  "DBClusterSnapshotIdentifier",
3540
3549
  ...POINT_IN_TIME_KEYS,
3541
- ...declaresPointInTimeRestore(properties) ? ["SourceDBInstanceIdentifier"] : []
3550
+ ...declaresPointInTimeRestore(properties) ? ["SourceDBInstanceIdentifier", "SourceDBClusterIdentifier"] : []
3542
3551
  ];
3543
3552
  const retention = properties?.["AutomaticBackupReplicationRetentionPeriod"];
3544
3553
  const declared = properties?.["ProcessorFeatures"];
@@ -3604,20 +3613,22 @@ function canonicalizeDriftProperties(resourceType, properties) {
3604
3613
  }
3605
3614
  async function canonicalizeDriftPair(resourceType, baseline, aws) {
3606
3615
  if (resourceType === "AWS::RDS::DBInstance") aws = withDeclaredVolumeMembers(baseline, withDeclaredProcessorFeatures(baseline, aws));
3607
- const recorded = baseline["SourceDBInstanceIdentifier"];
3608
- const live = aws["SourceDBInstanceIdentifier"];
3609
- if (resourceType !== "AWS::RDS::DBInstance" || typeof recorded !== "string" || typeof live !== "string" || recorded === live) return {
3616
+ if (resourceType !== "AWS::RDS::DBInstance") return {
3610
3617
  baseline,
3611
3618
  aws
3612
3619
  };
3613
- const region = await this.getClient().config.region();
3614
- return sameReplicaSource(recorded, live, { region }) ? {
3615
- baseline,
3616
- aws: {
3620
+ let region;
3621
+ for (const key of REPLICA_SOURCE_KEYS) {
3622
+ const recorded = baseline[key];
3623
+ const live = aws[key];
3624
+ if (typeof recorded !== "string" || typeof live !== "string" || recorded === live) continue;
3625
+ region ??= await this.getClient().config.region();
3626
+ if (sameReplicaSource(recorded, live, { region })) aws = {
3617
3627
  ...aws,
3618
- SourceDBInstanceIdentifier: recorded
3619
- }
3620
- } : {
3628
+ [key]: recorded
3629
+ };
3630
+ }
3631
+ return {
3621
3632
  baseline,
3622
3633
  aws
3623
3634
  };
@@ -3792,6 +3803,12 @@ async function readCurrentStateDBInstance(physicalId) {
3792
3803
  const ownArn = inst.DBInstanceArn;
3793
3804
  result["SourceDBInstanceIdentifier"] = liveSource.startsWith("arn:") || ownArn === void 0 || !ownArn.startsWith("arn:") ? liveSource : `${ownArn.slice(0, ownArn.lastIndexOf(":") + 1)}${liveSource}`;
3794
3805
  }
3806
+ const liveClusterSource = inst.ReadReplicaSourceDBClusterIdentifier;
3807
+ if (liveClusterSource !== void 0 && liveClusterSource !== "" && inst.DBClusterIdentifier === void 0) {
3808
+ const ownArn = inst.DBInstanceArn;
3809
+ const prefix = ownArn?.startsWith("arn:") === true ? ownArn.split(":").slice(0, 5) : void 0;
3810
+ result["SourceDBClusterIdentifier"] = liveClusterSource.startsWith("arn:") || prefix === void 0 || prefix.length < 5 ? liveClusterSource : `${prefix.join(":")}:cluster:${liveClusterSource}`;
3811
+ }
3795
3812
  result["AssociatedRoles"] = associatedRolesReadback(inst.AssociatedRoles);
3796
3813
  if (inst.DBInstanceArn) await this.attachTags(result, inst.DBInstanceArn);
3797
3814
  return result;
@@ -4026,6 +4043,7 @@ var RDSProvider = class {
4026
4043
  "MasterUserAuthenticationType",
4027
4044
  "AssociatedRoles",
4028
4045
  "SourceDBInstanceIdentifier",
4046
+ "SourceDBClusterIdentifier",
4029
4047
  "SourceRegion",
4030
4048
  "DBSnapshotIdentifier",
4031
4049
  "DBClusterSnapshotIdentifier",
@@ -4264,4 +4282,4 @@ var RDSProvider = class {
4264
4282
  };
4265
4283
 
4266
4284
  export { RDSProvider };
4267
- //# sourceMappingURL=rds-provider-CxSVX1d7.js.map
4285
+ //# sourceMappingURL=rds-provider-COq1pW0G.js.map