@cdkd/cli 0.338.0 → 0.339.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 (39) hide show
  1. package/dist/{ambient-client-defaults-Bz2AYX3k.js → ambient-client-defaults-D2df_dIB.js} +22 -3
  2. package/dist/{ambient-client-defaults-Bz2AYX3k.js.map → ambient-client-defaults-D2df_dIB.js.map} +1 -1
  3. package/dist/{asg-provider-CWmAKpgF.js → asg-provider-BiLQ0XWy.js} +4 -4
  4. package/dist/{asg-provider-CWmAKpgF.js.map → asg-provider-BiLQ0XWy.js.map} +1 -1
  5. package/dist/{aws-clients-ez_oXu6x.js → aws-clients-D3Z_tFc1.js} +4 -25
  6. package/dist/aws-clients-D3Z_tFc1.js.map +1 -0
  7. package/dist/cli.js +2 -2
  8. package/dist/{db-instance-modify-retry-Dks4BxMq.js → db-instance-modify-retry-DR1oW9Ln.js} +3 -3
  9. package/dist/{db-instance-modify-retry-Dks4BxMq.js.map → db-instance-modify-retry-DR1oW9Ln.js.map} +1 -1
  10. package/dist/{deploy-engine-BnsHKIjc.js → deploy-engine-BFlLAOb5.js} +188 -17
  11. package/dist/deploy-engine-BFlLAOb5.js.map +1 -0
  12. package/dist/{ecr-uri-Bekubfie.js → ecr-uri-DWcC0h82.js} +3 -3
  13. package/dist/{ecr-uri-Bekubfie.js.map → ecr-uri-DWcC0h82.js.map} +1 -1
  14. package/dist/{iam-role-provider-c85y_vuT.js → iam-role-provider-m_Kd7_uy.js} +5 -5
  15. package/dist/{iam-role-provider-c85y_vuT.js.map → iam-role-provider-m_Kd7_uy.js.map} +1 -1
  16. package/dist/index.d.ts +3 -0
  17. package/dist/index.d.ts.map +1 -1
  18. package/dist/index.js +4 -4
  19. package/dist/{neptune-provider-CLuvQucV.js → neptune-provider-Du2C7Q5P.js} +5 -5
  20. package/dist/{neptune-provider-CLuvQucV.js.map → neptune-provider-Du2C7Q5P.js.map} +1 -1
  21. package/dist/{program-CF2fN6wd.js → program-B-C6eA7H.js} +20 -35
  22. package/dist/program-B-C6eA7H.js.map +1 -0
  23. package/dist/{provider-classes-Ch72oCC3.js → provider-classes-ZB2dhH_W.js} +11 -11
  24. package/dist/{provider-classes-Ch72oCC3.js.map → provider-classes-ZB2dhH_W.js.map} +1 -1
  25. package/dist/{rds-provider-DDK78o9z.js → rds-provider-DzsTP_11.js} +338 -159
  26. package/dist/rds-provider-DzsTP_11.js.map +1 -0
  27. package/dist/{read-replica-C7nFHyNr.js → read-replica-DIfL8kl8.js} +5 -19
  28. package/dist/read-replica-DIfL8kl8.js.map +1 -0
  29. package/dist/rolldown-runtime-CNh9ExCG.js +17 -0
  30. package/dist/{update-removal--qeWEXhm.js → update-removal-DTvJXMeM.js} +2 -2
  31. package/dist/{update-removal--qeWEXhm.js.map → update-removal-DTvJXMeM.js.map} +1 -1
  32. package/dist/{version-bUHr9iDr.js → version-eQ4CwKON.js} +2 -2
  33. package/dist/{version-bUHr9iDr.js.map → version-eQ4CwKON.js.map} +1 -1
  34. package/package.json +11 -11
  35. package/dist/aws-clients-ez_oXu6x.js.map +0 -1
  36. package/dist/deploy-engine-BnsHKIjc.js.map +0 -1
  37. package/dist/program-CF2fN6wd.js.map +0 -1
  38. package/dist/rds-provider-DDK78o9z.js.map +0 -1
  39. package/dist/read-replica-C7nFHyNr.js.map +0 -1
@@ -1,13 +1,13 @@
1
1
  import { $ as safeMsg, n as describeAwsFailure, s as getLogger, y as generatedNameFor } from "./aws-failure-text-FKztQiaJ.js";
2
- import { E as relayedNameCollision, H as markNonRetryable, U as markRedactedCause, W as wrapMaskedAwsError, Z as CdkdError, h as ResourceUpdateNotSupportedError, nt as ProvisioningError, t as ambientClientDefaults } from "./ambient-client-defaults-Bz2AYX3k.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-D2df_dIB.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-DTvJXMeM.js";
3
4
  import { c as ambientRegion } from "./aws-client-defaults-BLXFsfMa.js";
4
- import { $i as tagPlanWarning, Gi as definedAttributes, Ki as stringifyIfAssigned, Nt as enclosingDeadlineRemainingMs, Sl as dynamicReferenceTokens, Yi as planTagDiff, Zi as refuseMalformedDesiredTags, ba as slowCcOperationTimeoutMs, jc as dbInstanceEngineChangeIsInPlace, ta as markDeleteStarted } from "./deploy-engine-BnsHKIjc.js";
5
- 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--qeWEXhm.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-Dks4BxMq.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-C7nFHyNr.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";
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, DescribeDBInstancesCommand, DescribeDBSubnetGroupsCommand, DescribeGlobalClustersCommand, DisableHttpEndpointCommand, EnableHttpEndpointCommand, ListTagsForResourceCommand, ModifyDBClusterCommand, ModifyDBInstanceCommand, ModifyDBSubnetGroupCommand, PromoteReadReplicaCommand, RDSClient, RebootDBInstanceCommand, RemoveFromGlobalClusterCommand, RemoveRoleFromDBClusterCommand, RemoveRoleFromDBInstanceCommand, RemoveTagsFromResourceCommand } 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, 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"));
@@ -450,6 +450,83 @@ function engineLifecycleSupportRefusalText(resourceType, logicalId, physicalId,
450
450
  const cli = kind === "DB cluster" ? "aws rds modify-db-cluster" : "aws rds modify-db-instance";
451
451
  return `${resourceType} ${logicalId}: EngineLifecycleSupport cannot change on an existing ${kind}. CloudFormation refuses the same update ("EngineLifecycleSupport cannot be modified."), whether the value changes, is added or is removed. Nothing was applied to ${kind} ${physicalId}. ` + (liveRead === "unreadable" ? `cdkd could not read the live setting (an AWS read failed), so it could not tell whether the ${kind} already holds the declared value; a re-run may succeed. ` : liveRead === "not-found" ? `RDS reports no such ${kind}: it was deleted outside cdkd, so the state record no longer matches AWS. ` : "") + `Declare the value the previous deploy declared (or none, if it declared none). To change the live setting, run ${cli} with --engine-lifecycle-support and --apply-immediately, then declare that value: a declared value the ${kind} already holds is no change.`;
452
452
  }
453
+ const BACKUP_REPLICATION_KEYS = [
454
+ "AutomaticBackupReplicationRegion",
455
+ "AutomaticBackupReplicationKmsKeyId",
456
+ "AutomaticBackupReplicationRetentionPeriod"
457
+ ];
458
+ const MALFORMED = Symbol("malformed");
459
+ function optionalString(value) {
460
+ if (value == null || value === "") return void 0;
461
+ return typeof value === "string" ? value : MALFORMED;
462
+ }
463
+ function optionalWholeNumber(value) {
464
+ if (value == null || value === "") return void 0;
465
+ const parsed = typeof value === "number" ? value : typeof value === "string" ? Number(value) : NaN;
466
+ return Number.isInteger(parsed) ? parsed : MALFORMED;
467
+ }
468
+ function backupReplicationOf(bag) {
469
+ const region = optionalString(bag["AutomaticBackupReplicationRegion"]);
470
+ const kmsKeyId = optionalString(bag["AutomaticBackupReplicationKmsKeyId"]);
471
+ const retention = optionalWholeNumber(bag["AutomaticBackupReplicationRetentionPeriod"]);
472
+ if (region === MALFORMED || kmsKeyId === MALFORMED || retention === MALFORMED) return "malformed";
473
+ return {
474
+ region,
475
+ kmsKeyId,
476
+ retention
477
+ };
478
+ }
479
+ function backupRetentionPeriodOf(bag) {
480
+ const value = optionalWholeNumber(bag["BackupRetentionPeriod"]);
481
+ return value === MALFORMED ? void 0 : value;
482
+ }
483
+ function backupReplicationPlan(properties, previousProperties, resourceType, logicalId, physicalId, stateBorne, warn) {
484
+ const none = {
485
+ stop: false,
486
+ start: void 0
487
+ };
488
+ const keys = [...BACKUP_REPLICATION_KEYS, "BackupRetentionPeriod"];
489
+ const desired = backupReplicationOf(properties);
490
+ const previous = backupReplicationOf(previousProperties);
491
+ if (desired === "malformed") {
492
+ if (keys.every((key) => isDeepStrictEqual(properties[key], previousProperties[key]))) return none;
493
+ throw markNonRetryable(new ProvisioningError(`${resourceType} ${logicalId}: AutomaticBackupReplicationRegion and AutomaticBackupReplicationKmsKeyId must be strings, and AutomaticBackupReplicationRetentionPeriod a whole number`, resourceType, logicalId, physicalId));
494
+ }
495
+ const misuse = desired.region === void 0 ? desired.kmsKeyId !== void 0 ? "You must specify the AutomaticBackupReplicationRegion parameter when setting the AutomaticBackupReplicationKmsKeyId parameter" : desired.retention !== void 0 ? "You must specify the AutomaticBackupReplicationRegion parameter when setting the AutomaticBackupReplicationRetentionPeriod parameter" : void 0 : backupRetentionPeriodOf(properties) === 0 ? "AutomaticBackupReplicationRegion cannot be specified when BackupRetentionPeriod is 0" : void 0;
496
+ if (misuse !== void 0) {
497
+ const message = `${resourceType} ${logicalId}: ${misuse} (as CloudFormation refuses it)`;
498
+ if (!stateBorne) throw markNonRetryable(new ProvisioningError(message, resourceType, logicalId, physicalId));
499
+ warn(`${message}; the restored properties declare it, so it is applied as declared`);
500
+ }
501
+ const start = desired.region === void 0 ? void 0 : {
502
+ ...desired,
503
+ region: desired.region
504
+ };
505
+ if (previous === "malformed") return {
506
+ stop: true,
507
+ start
508
+ };
509
+ if (previous.region === void 0) return {
510
+ stop: false,
511
+ start
512
+ };
513
+ if (desired.region === void 0) return {
514
+ stop: true,
515
+ start: void 0
516
+ };
517
+ return desired.retention === void 0 && backupRetentionPeriodOf(properties) !== void 0 && backupRetentionPeriodOf(properties) !== backupRetentionPeriodOf(previousProperties) || desired.region !== previous.region || desired.kmsKeyId !== previous.kmsKeyId || desired.retention !== previous.retention ? {
518
+ stop: true,
519
+ start
520
+ } : none;
521
+ }
522
+ function liveBackupReplicationRegions(instance) {
523
+ const regions = [];
524
+ for (const replication of instance.DBInstanceAutomatedBackupsReplications ?? []) {
525
+ const region = replication.DBInstanceAutomatedBackupsArn?.split(":")[3];
526
+ if (region !== void 0 && region !== "" && !regions.includes(region)) regions.push(region);
527
+ }
528
+ return regions;
529
+ }
453
530
 
454
531
  // src/provisioning/providers/rds/cluster-members.ts
455
532
  const CLUSTER_REMOVED_PORT = /* @__PURE__ */ new Map([
@@ -1510,6 +1587,232 @@ async function deleteAfterProtectionFlip(logicalId, physicalId, send) {
1510
1587
  });
1511
1588
  }
1512
1589
 
1590
+ // src/provisioning/providers/rds/calls.ts
1591
+ async function applyTagDiff(arn, resourceType, logicalId, oldTagsRaw, newTagsRaw) {
1592
+ const plan = planTagDiff(oldTagsRaw, newTagsRaw);
1593
+ const tagWarning = tagPlanWarning(plan, resourceType, logicalId);
1594
+ if (tagWarning !== void 0) this.logger.warn(tagWarning);
1595
+ const tagsToAdd = [...plan.set].map(([Key, Value]) => ({
1596
+ Key,
1597
+ Value
1598
+ }));
1599
+ const tagsToRemove = plan.remove;
1600
+ if (tagsToRemove.length > 0) {
1601
+ await this.getClient().send(new RemoveTagsFromResourceCommand({
1602
+ ResourceName: arn,
1603
+ TagKeys: tagsToRemove
1604
+ }));
1605
+ this.logger.debug(`Removed ${tagsToRemove.length} tag(s) from RDS resource ${arn}`);
1606
+ }
1607
+ if (tagsToAdd.length > 0) {
1608
+ await this.getClient().send(new AddTagsToResourceCommand({
1609
+ ResourceName: arn,
1610
+ Tags: tagsToAdd
1611
+ }));
1612
+ this.logger.debug(`Added/updated ${tagsToAdd.length} tag(s) on RDS resource ${arn}`);
1613
+ }
1614
+ }
1615
+ function isNotFoundError(error, faultName) {
1616
+ if (!(error instanceof Error)) return false;
1617
+ const name = error.name ?? "";
1618
+ const message = error.message.toLowerCase();
1619
+ return name === faultName || message.includes("not found") || message.includes("does not exist");
1620
+ }
1621
+ function wrapCaughtError(mask, error, build) {
1622
+ const m = maskerOrIdentity(mask);
1623
+ const failure = describeAwsFailure(error);
1624
+ if (!failure.redacted) return wrapMaskedAwsError(m, error, build);
1625
+ this.logger.debug(m(build(m(failure.detail)).message));
1626
+ const wrapped = build(`${m(failure.summary)}${relayedNameCollision(failure.detail)}`);
1627
+ return error instanceof Error ? markRedactedCause(wrapped) : wrapped;
1628
+ }
1629
+ function wrapDeleteError(mask, error, build) {
1630
+ const thrown = this.wrapCaughtError(mask, error, build);
1631
+ return error instanceof Error && error.name.includes("NotFound") ? markNotGone(thrown) : thrown;
1632
+ }
1633
+ async function engineLifecycleSupportToSend(kind, logicalId, physicalId, resourceType, properties, previousProperties, context) {
1634
+ const action = engineLifecycleSupportAction(properties, previousProperties, context);
1635
+ if (action === "unchanged") return void 0;
1636
+ const desired = engineLifecycleSupportOf(properties);
1637
+ if (action === "send") return desired;
1638
+ const idKey = kind === "DB cluster" ? "DBClusterIdentifier" : "DBInstanceIdentifier";
1639
+ const { mask } = withDerivedNameMasks(this.logger, createMaskedLogSinks(this.logger, context?.maskSecrets), [[previousProperties[idKey], physicalId]]);
1640
+ let liveRead = "read";
1641
+ if (action === "check-live") try {
1642
+ const resource = kind === "DB cluster" ? await this.describeDBCluster(physicalId) : await this.describeDBInstance(physicalId);
1643
+ if (resource === void 0) liveRead = "not-found";
1644
+ else if (resource.EngineLifecycleSupport === desired) liveRead = void 0;
1645
+ } catch (err) {
1646
+ if (err instanceof CdkdError) throw err;
1647
+ const faultName = err?.name;
1648
+ if (faultName === "DBClusterNotFoundFault" || faultName === "DBInstanceNotFoundFault") liveRead = "not-found";
1649
+ else throw this.wrapCaughtError(mask, err, (text) => new ProvisioningError(`${mask(engineLifecycleSupportRefusalText(resourceType, logicalId, physicalId, kind, "unreadable"))} The read failed: ${text}`, resourceType, logicalId, physicalId, err instanceof Error ? err : void 0));
1650
+ }
1651
+ if (liveRead === void 0) return void 0;
1652
+ throw markNonRetryable(new ProvisioningError(mask(engineLifecycleSupportRefusalText(resourceType, logicalId, physicalId, kind, liveRead)), resourceType, logicalId, physicalId));
1653
+ }
1654
+ async function describeDBCluster(dbClusterIdentifier) {
1655
+ return (await this.getClient().send(new DescribeDBClustersCommand({ DBClusterIdentifier: dbClusterIdentifier }))).DBClusters?.[0];
1656
+ }
1657
+ async function securityGroupsToSend(target, logicalId, physicalId, resourceType, properties, previousProperties, context) {
1658
+ const key = target === "DBCluster" ? "VpcSecurityGroupIds" : "VPCSecurityGroups";
1659
+ const noun = target === "DBCluster" ? "cluster" : "instance";
1660
+ const desired = properties[key];
1661
+ if (desired !== void 0) return desired.length > 0 ? desired : void 0;
1662
+ const previous = previousProperties[key];
1663
+ if (context?.desiredFromAwsReadback === true) return void 0;
1664
+ if (!Array.isArray(previous) || previous.length === 0) return void 0;
1665
+ let groupId;
1666
+ let missing;
1667
+ let awsError;
1668
+ try {
1669
+ let subnetGroupName;
1670
+ let vpcId;
1671
+ if (target === "DBInstance") {
1672
+ const subnetGroup = (await this.describeDBInstance(physicalId))?.DBSubnetGroup;
1673
+ subnetGroupName = subnetGroup?.DBSubnetGroupName;
1674
+ vpcId = subnetGroupName ? subnetGroup?.VpcId : void 0;
1675
+ } else {
1676
+ subnetGroupName = (await this.describeDBCluster(physicalId))?.DBSubnetGroup;
1677
+ vpcId = subnetGroupName ? (await this.getClient().send(new DescribeDBSubnetGroupsCommand({ DBSubnetGroupName: subnetGroupName }))).DBSubnetGroups?.[0]?.VpcId : void 0;
1678
+ }
1679
+ if (!subnetGroupName) missing = `the ${noun} reports no DB subnet group`;
1680
+ else if (!vpcId) missing = `DB subnet group ${subnetGroupName} reports no VPC`;
1681
+ else {
1682
+ groupId = (await this.getEc2Client().send(new DescribeSecurityGroupsCommand({ Filters: [{
1683
+ Name: "vpc-id",
1684
+ Values: [vpcId]
1685
+ }, {
1686
+ Name: "group-name",
1687
+ Values: ["default"]
1688
+ }] }))).SecurityGroups?.[0]?.GroupId;
1689
+ if (!groupId) missing = `VPC ${vpcId} has no security group named default`;
1690
+ }
1691
+ } catch (error) {
1692
+ awsError = error;
1693
+ }
1694
+ if (groupId === void 0) {
1695
+ const mask = context?.maskSecrets ?? ((text) => text);
1696
+ const failure = missing === void 0 ? describeAwsFailure(awsError) : void 0;
1697
+ if (failure?.redacted === true) this.logger.debug(safeMsg`${logicalId}: the VPC default security group lookup failed: ${mask(failure.detail)}`);
1698
+ const shown = mask(failure?.summary ?? "");
1699
+ const refusal = new ProvisioningError(`Failed to update ${target} ${logicalId}: ${key} was removed from the template, so the ${noun} moves to its VPC's default security group (as CloudFormation does), but cdkd could not find that group: ${missing ?? shown}. Declare ${key} in the template to choose the ${noun}'s security groups.`, resourceType, logicalId, physicalId, awsError instanceof Error ? awsError : void 0);
1700
+ if (missing !== void 0) throw markNonRetryable(refusal);
1701
+ throw awsError instanceof Error && (failure?.redacted === true || shown !== (failure?.summary ?? "")) ? markRedactedCause(refusal) : refusal;
1702
+ }
1703
+ this.logger.warn(safeMsg`${logicalId}: ${key} was removed from the template; attaching the VPC's default security group ${groupId}, as CloudFormation does.`);
1704
+ return [groupId];
1705
+ }
1706
+ async function describeDBInstance(dbInstanceIdentifier) {
1707
+ return (await this.getClient().send(new DescribeDBInstancesCommand({ DBInstanceIdentifier: dbInstanceIdentifier }))).DBInstances?.[0];
1708
+ }
1709
+ async function sendHttpEndpointChange(logicalId, physicalId, arn, enable) {
1710
+ let delay = 5e3;
1711
+ for (let attempt = 1;; attempt += 1) {
1712
+ await this.waitForClusterState(logicalId, physicalId, (cluster) => cluster.Status === "available", "pending changes to settle before the Data API call");
1713
+ try {
1714
+ await this.getClient().send(enable ? new EnableHttpEndpointCommand({ ResourceArn: arn }) : new DisableHttpEndpointCommand({ ResourceArn: arn }));
1715
+ return;
1716
+ } catch (error) {
1717
+ const name = awsErrorName(error);
1718
+ if (!HTTP_ENDPOINT_BUSY_FAULTS.has(name) || attempt >= 8) throw error;
1719
+ this.logger.debug(safeMsg`DBCluster ${logicalId}: the Data API call was refused as busy (${name}); retrying`);
1720
+ await this.sleep(delay);
1721
+ delay = Math.min(delay * 2, 1e4);
1722
+ }
1723
+ }
1724
+ }
1725
+ async function attachTags(result, arn) {
1726
+ try {
1727
+ const tagsResp = await this.getClient().send(new ListTagsForResourceCommand({ ResourceName: arn }));
1728
+ result["Tags"] = normalizeAwsTagsToCfn(tagsResp.TagList);
1729
+ } catch (err) {
1730
+ this.logger.debug(`RDS ListTagsForResource(${arn}) failed: ${describeAwsFailure(err).detail}`);
1731
+ }
1732
+ }
1733
+ async function sendInRegion(region, call) {
1734
+ const client = new RDSClient({
1735
+ ...ambientClientDefaults(),
1736
+ region
1737
+ });
1738
+ try {
1739
+ return await call(client);
1740
+ } finally {
1741
+ client.destroy();
1742
+ }
1743
+ }
1744
+ const REPLICATION_KMS_KEY_ERROR = "Encrypted instances require a valid KMS key ID";
1745
+ const REPLICATION_BUSY_FAULTS = /* @__PURE__ */ new Set([
1746
+ "InvalidDBInstanceStateFault",
1747
+ "InvalidDBInstanceState",
1748
+ "InvalidDBInstanceAutomatedBackupStateFault",
1749
+ "InvalidDBInstanceAutomatedBackupState"
1750
+ ]);
1751
+ const REPLICATION_MAX_ATTEMPTS = 10;
1752
+ async function sendReplicationCall(logicalId, physicalId, region, call) {
1753
+ for (let attempt = 1;; attempt++) try {
1754
+ return await sendInRegion(region, call);
1755
+ } catch (error) {
1756
+ if (!REPLICATION_BUSY_FAULTS.has(awsErrorName(error)) || attempt >= REPLICATION_MAX_ATTEMPTS) throw error;
1757
+ this.logger.debug(safeMsg`${logicalId}: automated backup replication call refused as busy (${awsErrorName(error)}); waiting to resend`);
1758
+ await this.sleep(15e3);
1759
+ const budgetMs = Math.min(18e5, enclosingDeadlineRemainingMs() - 3e4);
1760
+ if (budgetMs <= 0) throw error;
1761
+ await this.waitForInstanceAvailable(logicalId, physicalId, budgetMs, "changing its automated backup replication");
1762
+ }
1763
+ }
1764
+ async function applyBackupReplication(logicalId, physicalId, plan, fromReadback = false) {
1765
+ if (!plan.stop && plan.start === void 0) return;
1766
+ const waitBudgetMs = Math.min(18e5, enclosingDeadlineRemainingMs() - 3e4);
1767
+ if (waitBudgetMs <= 0) throw new Error("the resource timeout leaves no more time to change the automated backup replication of the instance; re-run the deploy, or with a longer --resource-timeout");
1768
+ if (fromReadback && plan.start !== void 0 && plan.start.kmsKeyId === void 0) {
1769
+ if ((await this.describeDBInstance(physicalId))?.StorageEncrypted === true) throw markNonRetryable(/* @__PURE__ */ new Error(`cdkd drift --revert cannot restart the automated backup replication of storage-encrypted DB instance ${logicalId}: RDS needs a KMS key in ${plan.start.region} for it, and AutomaticBackupReplicationKmsKeyId is write-only, so the revert has none to send. Nothing was stopped or started. Restore it with aws rds start-db-instance-automated-backups-replication --region ${plan.start.region} --source-db-instance-arn <the instance ARN> --kms-key-id <a key in that region>, or change the template's replication properties and run cdkd deploy`));
1770
+ }
1771
+ await this.waitForInstanceAvailable(logicalId, physicalId, waitBudgetMs, "changing its automated backup replication");
1772
+ const instance = await this.describeDBInstance(physicalId);
1773
+ const arn = instance?.DBInstanceArn;
1774
+ if (instance === void 0 || arn === void 0) throw new Error("DescribeDBInstances returned no instance ARN while changing its automated backup replication; nothing was started or stopped");
1775
+ const wait = process.env["CDKD_NO_WAIT"] !== "true";
1776
+ const live = liveBackupReplicationRegions(instance);
1777
+ for (const region of live) {
1778
+ this.logger.debug(safeMsg`Stopping automated backup replication of ${logicalId} to ${region}`);
1779
+ await sendReplicationCall.call(this, logicalId, physicalId, region, (client) => client.send(new StopDBInstanceAutomatedBackupsReplicationCommand({ SourceDBInstanceArn: arn })));
1780
+ }
1781
+ if (live.length > 0 && (wait || plan.start !== void 0)) await this.waitForInstanceState(logicalId, physicalId, (current) => current.DBInstanceStatus === "available" && liveBackupReplicationRegions(current).length === 0, "automated backup replication stop");
1782
+ const start = plan.start;
1783
+ if (start === void 0) return;
1784
+ this.logger.debug(safeMsg`Starting automated backup replication of ${logicalId} to ${start.region}`);
1785
+ try {
1786
+ await sendReplicationCall.call(this, logicalId, physicalId, start.region, (client) => client.send(new StartDBInstanceAutomatedBackupsReplicationCommand({
1787
+ SourceDBInstanceArn: arn,
1788
+ ...start.retention !== void 0 && { BackupRetentionPeriod: start.retention },
1789
+ ...start.kmsKeyId !== void 0 && { KmsKeyId: start.kmsKeyId }
1790
+ })));
1791
+ } catch (error) {
1792
+ if (error instanceof Error && error.message.includes(REPLICATION_KMS_KEY_ERROR)) error.message = `${error.message} Provide a valid value for the AutomaticBackupReplicationKmsKeyId property.`;
1793
+ throw error;
1794
+ }
1795
+ if (wait) await this.waitForInstanceState(logicalId, physicalId, (current) => current.DBInstanceStatus === "available" && liveBackupReplicationRegions(current).includes(start.region), "automated backup replication start");
1796
+ }
1797
+ const RETENTION_READ_SOFT_FAULTS = /* @__PURE__ */ new Set([
1798
+ "DBInstanceAutomatedBackupNotFoundFault",
1799
+ "DBInstanceAutomatedBackupNotFound",
1800
+ "AccessDenied",
1801
+ "AccessDeniedException"
1802
+ ]);
1803
+ async function replicatedBackupRetention(automatedBackupsArn) {
1804
+ const region = automatedBackupsArn.split(":")[3];
1805
+ if (region === void 0 || region === "") return void 0;
1806
+ try {
1807
+ return (await sendInRegion(region, (client) => client.send(new DescribeDBInstanceAutomatedBackupsCommand({ DBInstanceAutomatedBackupsArn: automatedBackupsArn })))).DBInstanceAutomatedBackups?.[0]?.BackupRetentionPeriod;
1808
+ } catch (error) {
1809
+ const name = awsErrorName(error);
1810
+ if (!RETENTION_READ_SOFT_FAULTS.has(name)) throw error;
1811
+ if (name.startsWith("AccessDenied")) this.logger.warn(safeMsg`Could not read the replicated automated backup's retention in ${region} (${name}): AutomaticBackupReplicationRetentionPeriod reads as unset`);
1812
+ return;
1813
+ }
1814
+ }
1815
+
1513
1816
  // src/provisioning/providers/rds/instance-create.ts
1514
1817
  async function createDBInstance(logicalId, resourceType, properties, mask, replaying = false) {
1515
1818
  this.logger.debug(`Creating DBInstance ${logicalId}`);
@@ -1517,6 +1820,7 @@ async function createDBInstance(logicalId, resourceType, properties, mask, repla
1517
1820
  const roles = this.desiredAssociatedRoles(properties, resourceType, logicalId, void 0, replaying);
1518
1821
  const logExports = desiredLogExports(properties, resourceType, logicalId);
1519
1822
  const processor = desiredProcessorFeatures(properties, resourceType, logicalId);
1823
+ const replication = backupReplicationPlan(properties, {}, resourceType, logicalId, void 0, replaying, (message) => this.logger.warn(message));
1520
1824
  refuseMalformedReplicaSource(properties, resourceType, logicalId);
1521
1825
  refuseUnknownSourceRegion(properties, resourceType, logicalId, replaying, (message) => this.logger.warn(message));
1522
1826
  const replicaSource = replicaSourceOf(properties);
@@ -1599,11 +1903,12 @@ async function createDBInstance(logicalId, resourceType, properties, mask, repla
1599
1903
  const modifyAfterCreate = replicaSource !== void 0 && replicaNeedsModifyAfterCreate(properties, replicaEngineName, instance.Engine);
1600
1904
  if (process.env["CDKD_NO_WAIT"] !== "true" || modifyAfterCreate) await this.waitForInstanceAvailable(logicalId, dbInstanceIdentifier);
1601
1905
  if (modifyAfterCreate) await modifyReplicaAfterCreate.call(this, logicalId, dbInstanceIdentifier, properties, replicaEngineName);
1602
- if (roles !== "skipped") try {
1603
- await this.applyAssociatedRoles("instance", logicalId, dbInstanceIdentifier, roles, [], mask, void 0);
1604
- } catch (roleError) {
1605
- markAuxiliaryFailure(roleError, logicalId);
1606
- throw roleError;
1906
+ try {
1907
+ if (roles !== "skipped") await this.applyAssociatedRoles("instance", logicalId, dbInstanceIdentifier, roles, [], mask, void 0);
1908
+ await applyBackupReplication.call(this, logicalId, dbInstanceIdentifier, replication);
1909
+ } catch (auxiliaryError) {
1910
+ markAuxiliaryFailure(auxiliaryError, logicalId);
1911
+ throw auxiliaryError;
1607
1912
  }
1608
1913
  const described = await this.describeDBInstance(dbInstanceIdentifier);
1609
1914
  return {
@@ -1660,6 +1965,7 @@ async function updateDBInstance(logicalId, physicalId, resourceType, properties,
1660
1965
  const roles = this.desiredAssociatedRoles(properties, resourceType, logicalId, physicalId, false);
1661
1966
  const logExportConfig = logExportsDelta(desiredLogExports(properties, resourceType, logicalId, physicalId), previousProperties["EnableCloudwatchLogsExports"]);
1662
1967
  const processorMembers = instanceProcessorFeatureMembers(properties, previousProperties, resourceType, logicalId, physicalId);
1968
+ const replication = backupReplicationPlan(properties, previousProperties, resourceType, logicalId, physicalId, context?.replayingState === true || context?.desiredFromAwsReadback === true, (message) => this.logger.warn(message));
1663
1969
  const vpcSgIds = await this.securityGroupsToSend("DBInstance", logicalId, physicalId, resourceType, properties, previousProperties, context);
1664
1970
  const engineLifecycleSupport = await this.engineLifecycleSupportToSend("DB instance", logicalId, physicalId, resourceType, properties, previousProperties, context);
1665
1971
  let authenticationType = masterUserAuthenticationTypeToSend(properties, previousProperties, context);
@@ -1789,6 +2095,7 @@ async function updateDBInstance(logicalId, physicalId, resourceType, properties,
1789
2095
  const sentGroup = backfillMembers.DBParameterGroupName;
1790
2096
  if (sentGroup !== void 0 || instanceParameterGroupPendingReboot(described) || instanceParameterGroupApplying(described)) described = await this.rebootForPendingParameterGroup(logicalId, physicalId, sentGroup, String(properties["CertificateRotationRestart"]) === "true");
1791
2097
  await this.applyAssociatedRoles("instance", logicalId, physicalId, roles, associatedRoleList(previousProperties["AssociatedRoles"], { featureNameRequired: true }) ?? [], context?.maskSecrets, context);
2098
+ await applyBackupReplication.call(this, logicalId, physicalId, replication, context?.desiredFromAwsReadback === true);
1792
2099
  if (described?.DBInstanceArn) await this.applyTagDiff(described.DBInstanceArn, resourceType, logicalId, previousProperties["Tags"], properties["Tags"]);
1793
2100
  return {
1794
2101
  physicalId,
@@ -1935,150 +2242,6 @@ async function deleteInstanceAfterProtectionFlip(logicalId, physicalId, send) {
1935
2242
  });
1936
2243
  }
1937
2244
 
1938
- // src/provisioning/providers/rds/calls.ts
1939
- async function applyTagDiff(arn, resourceType, logicalId, oldTagsRaw, newTagsRaw) {
1940
- const plan = planTagDiff(oldTagsRaw, newTagsRaw);
1941
- const tagWarning = tagPlanWarning(plan, resourceType, logicalId);
1942
- if (tagWarning !== void 0) this.logger.warn(tagWarning);
1943
- const tagsToAdd = [...plan.set].map(([Key, Value]) => ({
1944
- Key,
1945
- Value
1946
- }));
1947
- const tagsToRemove = plan.remove;
1948
- if (tagsToRemove.length > 0) {
1949
- await this.getClient().send(new RemoveTagsFromResourceCommand({
1950
- ResourceName: arn,
1951
- TagKeys: tagsToRemove
1952
- }));
1953
- this.logger.debug(`Removed ${tagsToRemove.length} tag(s) from RDS resource ${arn}`);
1954
- }
1955
- if (tagsToAdd.length > 0) {
1956
- await this.getClient().send(new AddTagsToResourceCommand({
1957
- ResourceName: arn,
1958
- Tags: tagsToAdd
1959
- }));
1960
- this.logger.debug(`Added/updated ${tagsToAdd.length} tag(s) on RDS resource ${arn}`);
1961
- }
1962
- }
1963
- function isNotFoundError(error, faultName) {
1964
- if (!(error instanceof Error)) return false;
1965
- const name = error.name ?? "";
1966
- const message = error.message.toLowerCase();
1967
- return name === faultName || message.includes("not found") || message.includes("does not exist");
1968
- }
1969
- function wrapCaughtError(mask, error, build) {
1970
- const m = maskerOrIdentity(mask);
1971
- const failure = describeAwsFailure(error);
1972
- if (!failure.redacted) return wrapMaskedAwsError(m, error, build);
1973
- this.logger.debug(m(build(m(failure.detail)).message));
1974
- const wrapped = build(`${m(failure.summary)}${relayedNameCollision(failure.detail)}`);
1975
- return error instanceof Error ? markRedactedCause(wrapped) : wrapped;
1976
- }
1977
- function wrapDeleteError(mask, error, build) {
1978
- const thrown = this.wrapCaughtError(mask, error, build);
1979
- return error instanceof Error && error.name.includes("NotFound") ? markNotGone(thrown) : thrown;
1980
- }
1981
- async function engineLifecycleSupportToSend(kind, logicalId, physicalId, resourceType, properties, previousProperties, context) {
1982
- const action = engineLifecycleSupportAction(properties, previousProperties, context);
1983
- if (action === "unchanged") return void 0;
1984
- const desired = engineLifecycleSupportOf(properties);
1985
- if (action === "send") return desired;
1986
- const idKey = kind === "DB cluster" ? "DBClusterIdentifier" : "DBInstanceIdentifier";
1987
- const { mask } = withDerivedNameMasks(this.logger, createMaskedLogSinks(this.logger, context?.maskSecrets), [[previousProperties[idKey], physicalId]]);
1988
- let liveRead = "read";
1989
- if (action === "check-live") try {
1990
- const resource = kind === "DB cluster" ? await this.describeDBCluster(physicalId) : await this.describeDBInstance(physicalId);
1991
- if (resource === void 0) liveRead = "not-found";
1992
- else if (resource.EngineLifecycleSupport === desired) liveRead = void 0;
1993
- } catch (err) {
1994
- if (err instanceof CdkdError) throw err;
1995
- const faultName = err?.name;
1996
- if (faultName === "DBClusterNotFoundFault" || faultName === "DBInstanceNotFoundFault") liveRead = "not-found";
1997
- else throw this.wrapCaughtError(mask, err, (text) => new ProvisioningError(`${mask(engineLifecycleSupportRefusalText(resourceType, logicalId, physicalId, kind, "unreadable"))} The read failed: ${text}`, resourceType, logicalId, physicalId, err instanceof Error ? err : void 0));
1998
- }
1999
- if (liveRead === void 0) return void 0;
2000
- throw markNonRetryable(new ProvisioningError(mask(engineLifecycleSupportRefusalText(resourceType, logicalId, physicalId, kind, liveRead)), resourceType, logicalId, physicalId));
2001
- }
2002
- async function describeDBCluster(dbClusterIdentifier) {
2003
- return (await this.getClient().send(new DescribeDBClustersCommand({ DBClusterIdentifier: dbClusterIdentifier }))).DBClusters?.[0];
2004
- }
2005
- async function securityGroupsToSend(target, logicalId, physicalId, resourceType, properties, previousProperties, context) {
2006
- const key = target === "DBCluster" ? "VpcSecurityGroupIds" : "VPCSecurityGroups";
2007
- const noun = target === "DBCluster" ? "cluster" : "instance";
2008
- const desired = properties[key];
2009
- if (desired !== void 0) return desired.length > 0 ? desired : void 0;
2010
- const previous = previousProperties[key];
2011
- if (context?.desiredFromAwsReadback === true) return void 0;
2012
- if (!Array.isArray(previous) || previous.length === 0) return void 0;
2013
- let groupId;
2014
- let missing;
2015
- let awsError;
2016
- try {
2017
- let subnetGroupName;
2018
- let vpcId;
2019
- if (target === "DBInstance") {
2020
- const subnetGroup = (await this.describeDBInstance(physicalId))?.DBSubnetGroup;
2021
- subnetGroupName = subnetGroup?.DBSubnetGroupName;
2022
- vpcId = subnetGroupName ? subnetGroup?.VpcId : void 0;
2023
- } else {
2024
- subnetGroupName = (await this.describeDBCluster(physicalId))?.DBSubnetGroup;
2025
- vpcId = subnetGroupName ? (await this.getClient().send(new DescribeDBSubnetGroupsCommand({ DBSubnetGroupName: subnetGroupName }))).DBSubnetGroups?.[0]?.VpcId : void 0;
2026
- }
2027
- if (!subnetGroupName) missing = `the ${noun} reports no DB subnet group`;
2028
- else if (!vpcId) missing = `DB subnet group ${subnetGroupName} reports no VPC`;
2029
- else {
2030
- groupId = (await this.getEc2Client().send(new DescribeSecurityGroupsCommand({ Filters: [{
2031
- Name: "vpc-id",
2032
- Values: [vpcId]
2033
- }, {
2034
- Name: "group-name",
2035
- Values: ["default"]
2036
- }] }))).SecurityGroups?.[0]?.GroupId;
2037
- if (!groupId) missing = `VPC ${vpcId} has no security group named default`;
2038
- }
2039
- } catch (error) {
2040
- awsError = error;
2041
- }
2042
- if (groupId === void 0) {
2043
- const mask = context?.maskSecrets ?? ((text) => text);
2044
- const failure = missing === void 0 ? describeAwsFailure(awsError) : void 0;
2045
- if (failure?.redacted === true) this.logger.debug(safeMsg`${logicalId}: the VPC default security group lookup failed: ${mask(failure.detail)}`);
2046
- const shown = mask(failure?.summary ?? "");
2047
- const refusal = new ProvisioningError(`Failed to update ${target} ${logicalId}: ${key} was removed from the template, so the ${noun} moves to its VPC's default security group (as CloudFormation does), but cdkd could not find that group: ${missing ?? shown}. Declare ${key} in the template to choose the ${noun}'s security groups.`, resourceType, logicalId, physicalId, awsError instanceof Error ? awsError : void 0);
2048
- if (missing !== void 0) throw markNonRetryable(refusal);
2049
- throw awsError instanceof Error && (failure?.redacted === true || shown !== (failure?.summary ?? "")) ? markRedactedCause(refusal) : refusal;
2050
- }
2051
- this.logger.warn(safeMsg`${logicalId}: ${key} was removed from the template; attaching the VPC's default security group ${groupId}, as CloudFormation does.`);
2052
- return [groupId];
2053
- }
2054
- async function describeDBInstance(dbInstanceIdentifier) {
2055
- return (await this.getClient().send(new DescribeDBInstancesCommand({ DBInstanceIdentifier: dbInstanceIdentifier }))).DBInstances?.[0];
2056
- }
2057
- async function sendHttpEndpointChange(logicalId, physicalId, arn, enable) {
2058
- let delay = 5e3;
2059
- for (let attempt = 1;; attempt += 1) {
2060
- await this.waitForClusterState(logicalId, physicalId, (cluster) => cluster.Status === "available", "pending changes to settle before the Data API call");
2061
- try {
2062
- await this.getClient().send(enable ? new EnableHttpEndpointCommand({ ResourceArn: arn }) : new DisableHttpEndpointCommand({ ResourceArn: arn }));
2063
- return;
2064
- } catch (error) {
2065
- const name = awsErrorName(error);
2066
- if (!HTTP_ENDPOINT_BUSY_FAULTS.has(name) || attempt >= 8) throw error;
2067
- this.logger.debug(safeMsg`DBCluster ${logicalId}: the Data API call was refused as busy (${name}); retrying`);
2068
- await this.sleep(delay);
2069
- delay = Math.min(delay * 2, 1e4);
2070
- }
2071
- }
2072
- }
2073
- async function attachTags(result, arn) {
2074
- try {
2075
- const tagsResp = await this.getClient().send(new ListTagsForResourceCommand({ ResourceName: arn }));
2076
- result["Tags"] = normalizeAwsTagsToCfn(tagsResp.TagList);
2077
- } catch (err) {
2078
- this.logger.debug(`RDS ListTagsForResource(${arn}) failed: ${describeAwsFailure(err).detail}`);
2079
- }
2080
- }
2081
-
2082
2245
  // src/provisioning/providers/rds/waits.ts
2083
2246
  async function waitForMemberAfterClusterChange(dbInstanceIdentifier, clusterLogicalId, transitional, change, maxWaitMs = 18e5) {
2084
2247
  const startTime = Date.now();
@@ -2314,10 +2477,16 @@ function getDriftUnknownPaths(resourceType, properties) {
2314
2477
  "AllowMajorVersionUpgrade",
2315
2478
  "CertificateRotationRestart",
2316
2479
  "SourceRegion",
2317
- "UseDefaultProcessorFeatures"
2480
+ "UseDefaultProcessorFeatures",
2481
+ "AutomaticBackupReplicationKmsKeyId"
2318
2482
  ];
2483
+ const retention = properties?.["AutomaticBackupReplicationRetentionPeriod"];
2319
2484
  const declared = properties?.["ProcessorFeatures"];
2320
- return declared == null || Array.isArray(declared) && declared.length === 0 ? [...instanceUnknown, "ProcessorFeatures"] : instanceUnknown;
2485
+ return [
2486
+ ...instanceUnknown,
2487
+ ...declared == null || Array.isArray(declared) && declared.length === 0 ? ["ProcessorFeatures"] : [],
2488
+ ...retention == null || retention === "" ? ["AutomaticBackupReplicationRetentionPeriod"] : []
2489
+ ];
2321
2490
  }
2322
2491
  if (resourceType !== "AWS::RDS::DBCluster") return [];
2323
2492
  const neverRead = [
@@ -2527,6 +2696,13 @@ async function readCurrentStateDBInstance(physicalId) {
2527
2696
  Name: feature.Name,
2528
2697
  Value: feature.Value
2529
2698
  }));
2699
+ const replicationArn = inst.DBInstanceAutomatedBackupsReplications?.[0]?.DBInstanceAutomatedBackupsArn;
2700
+ const replicationRegion = replicationArn?.split(":")[3];
2701
+ if (replicationArn !== void 0 && replicationRegion !== void 0 && replicationRegion !== "") {
2702
+ result["AutomaticBackupReplicationRegion"] = replicationRegion;
2703
+ const retention = await replicatedBackupRetention.call(this, replicationArn);
2704
+ if (retention !== void 0) result["AutomaticBackupReplicationRetentionPeriod"] = retention;
2705
+ }
2530
2706
  if (inst.DBName !== void 0) result["DBName"] = inst.DBName;
2531
2707
  if (inst.AvailabilityZone !== void 0 && inst.MultiAZ !== true) result["AvailabilityZone"] = inst.AvailabilityZone;
2532
2708
  if (inst.EngineLifecycleSupport !== void 0 && inst.DBClusterIdentifier === void 0) result["EngineLifecycleSupport"] = inst.EngineLifecycleSupport;
@@ -2762,7 +2938,10 @@ var RDSProvider = class {
2762
2938
  "SourceDBInstanceIdentifier",
2763
2939
  "SourceRegion",
2764
2940
  "ProcessorFeatures",
2765
- "UseDefaultProcessorFeatures"
2941
+ "UseDefaultProcessorFeatures",
2942
+ "AutomaticBackupReplicationRegion",
2943
+ "AutomaticBackupReplicationKmsKeyId",
2944
+ "AutomaticBackupReplicationRetentionPeriod"
2766
2945
  ])]
2767
2946
  ]);
2768
2947
  unhandledByDesign = /* @__PURE__ */ new Map([["AWS::RDS::DBCluster", /* @__PURE__ */ new Map([
@@ -2984,4 +3163,4 @@ var RDSProvider = class {
2984
3163
  };
2985
3164
 
2986
3165
  export { RDSProvider };
2987
- //# sourceMappingURL=rds-provider-DDK78o9z.js.map
3166
+ //# sourceMappingURL=rds-provider-DzsTP_11.js.map