Repository navigation
feat(cloudformation): support Redshift snapshot restores - #6395
Conversation
PR Summary by QodoSupport Redshift snapshot restores in CloudFormation
AI Description
Diagram
High-Level Assessment
Files changed (7)
|
Code Review by Qodo
1.
|
- Reconcile ManageMasterPassword and KMS key on in-place cluster update - Avoid overriding inherited snapshot passwords on unrelated template changes - Reconcile tags by deleting removed tags on update - Mint ARN for parameter group tags to prevent invalid parameter errors - Scope mutate locking during snapshot restore to prevent stalling writes
pgermosen
left a comment
There was a problem hiding this comment.
@vuthehuyht thanks, not ready to merge yet. The SnapshotIdentifier restore belongs here, but the tag fix (Tags on a Redshift cluster or parameter group fail on main today), switching ManageMasterPassword and its KMS key in place, and dropping the service lock from the existing RestoreFromClusterSnapshot path each deserve their own PR.
The new private attributes, the password hash above all, should use __Floci keys like the other provisioners, since Fn::GetAtt only hides those. Floci::DBName can move with them.
The store write under mutate, the restored-cluster cleanup and the Secrets Manager check now repeat several times, so a small helper for each would keep them in one place.
pgermosen
left a comment
There was a problem hiding this comment.
@vuthehuyht thanks, the scope looks right now, but it's not quite ready yet. Values a replacement rollback has to put back already have a prefix, CfnRollback.USES_ATTR_PREFIX, which ReplacementCleanup restores by itself, as the Route53 health check does with its create-only values. Naming the Redshift keys with it lets the __FlociRedshiftPriorAttributes blob and the custom rollbackUpdate go away.
A stack created before this change still carries Floci::DBName, so falling back to it when the new key is missing keeps a DBName change on such a stack a replacement.
pgermosen
left a comment
There was a problem hiding this comment.
@vuthehuyht thanks, the Redshift keys now go through the shared rollback, and falling back to Floci::DBName keeps a DBName change on older stacks a replacement.
(follow-up, separate PR) The pieces split out earlier still apply on main. A cluster or parameter group with Tags fails, because createTags gets the bare name and RedshiftService only accepts an ARN. A change to ManageMasterPassword or MasterPasswordSecretKmsKeyId on an existing cluster is ignored, since that path only calls modifyCluster. And the RestoreFromClusterSnapshot API still runs the whole restore under the service lock.
Summary
Honor
SnapshotIdentifierwhen creatingAWS::Redshift::Cluster: restore the snapshot's SQL dump instead of creating an empty database, inherit its admin credentials, and supportManageMasterPasswordwith a new Secrets Manager secret.Changing, adding, or removing the snapshot replaces the cluster through the existing cleanup and rollback mechanism. Updates with an unchanged snapshot preserve the cluster and its data. Keep endpoint references and managed-secret attributes accurate, and pass cluster ARNs when applying CloudFormation tags.
Type of change
fix:)feat:)feat!:orfix!:)AWS Compatibility
Validation:
RedshiftClusterCfnProvisionerTest,RedshiftServiceTest,RedshiftQueryHandlerTest.RedshiftSnapshotCfnIntegrationTest,RedshiftFinalSnapshotIntegrationTest.RedshiftClusterCfnIntegrationTestskipped because Docker is unavailable. The non-Docker integration run used-Dfloci.docker.docker-host=tcp://127.0.0.1:1to avoid Windows named-pipe retry delays; container operations are mocked in those tests.make docs-check, partition literal check, andgit diff --checkpassed.Checklist
./mvnw testpasses locallyThe full test suite was not run; validation was limited to the focused suites above.