Repository navigation
feat(rds): honor DeletionProtection on cluster restores and AWS::RDS::DBCluster - #9057
Conversation
RestoreDBClusterFromSnapshot and RestoreDBClusterToPointInTime now read DeletionProtection and set it on the new cluster before it is stored. A restore that fails after creating the cluster clears the flag before deleting it again.
The DBCluster provisioner reads DeletionProtection, creates the cluster with it, and applies a changed value on stack update. A stack delete of a protected cluster is refused by DeleteDBCluster and reported as the resource's DELETE_FAILED, as on AWS.
PR Summary by QodoHonor deletion protection on RDS cluster restores and CloudFormation clusters
AI Description
Merge Risk
|
Code Review by Qodo
1.
|
pgermosen
left a comment
There was a problem hiding this comment.
@rajp33 thanks, these are both follow-ups from #8985: the two restores now create the cluster with the DeletionProtection they're given, AWS::RDS::DBCluster passes it on create and update so a stack can turn it off before deleting, and a failed restore or role attach clears it before removing what it made.
Summary
RestoreDBClusterFromSnapshot and RestoreDBClusterToPointInTime now honor
DeletionProtection, andAWS::RDS::DBClusterpasses it to the cluster. Follow-up to #8985.DeletionProtectionand set it on the new cluster before it is first stored. A restore that fails after creating the cluster clears the flag before its cleanup delete.AWS::RDS::DBClusterpassesDeletionProtectionon create and applies a changed value in place on update, so a stack can turn protection off before deleting. The property is removed from the accepted-and-ignored list inwritable-property-gaps.tsv.DELETE_FAILEDwith theInvalidParameterCombinationmessage, and the stack ends inDELETE_FAILED.docs/services/rds.mdnotes that both restores setDeletionProtection.Closes #9056
Type of change
fix:)feat:)feat!:orfix!:)AWS Compatibility
Previously both restores created an unprotected cluster whatever
DeletionProtectionsaid, and a CloudFormation cluster withDeletionProtection: truecould be deleted. On AWS, both restores acceptDeletionProtection, and DeleteStack fails while the stack's DBCluster is protected.Covered by:
RdsClusterDeletionProtectionIntegrationTest: each restore with protection is described as protected and its delete is refused;CloudFormationRdsDeletionProtectionIntegrationTest: a stack cluster created protected, updated to unprotected and back, then DeleteStack ends inDELETE_FAILEDwith the cluster still protected.Checklist
./mvnw testpasses locally./mvnw testis not ticked because the full suite runs out of memory during test discovery onmainas well. Locally, the RDS cluster restore and deletion protection integration tests, the CloudFormation RDS integration tests,RdsCfnProvisionerTest,CfnSchemaCoverageTest,RdsQueryHandlerTestandRdsServiceTestpass (1154 tests, 0 failures), and./mvnw checkstyle:checkandmake docs-checkpass.