(docdb): Updating secret name or switching from an auto-generated secret to an imported one requires cluster replacement even though it could be updated without replacement #29917
Labels
@aws-cdk/aws-docdb
Related to Amazon DocumentDB
bug
This issue is a bug.
effort/medium
Medium work item – several days of effort
p2
Describe the bug
When updating the
masterUser.secretName
field ofdocdb.DatabaseCluster
, or switching from an auto-generated secret withoutmasterUser.password
to importing one viamasterUser.password
, the cluster needs to be replaced on deploy. This is because the MasterUsername field in the CFN changes, since it references a secret value. However, the construct already knows the username from themasterUser.username
prop, so this replacement could be avoided by just setting MasterUsername directly as a string rather than a secret value lookup.Expected Behavior
Updating
masterUser.secretName
on adocdb.DatabaseCluster
or addingmasterUser.password
should not require replacement of the cluster.Current Behavior
Updating
masterUser.secretName
on adocdb.DatabaseCluster
or addingmasterUser.password
requires replacement of the cluster.Reproduction Steps
Possible Solution
This issue could be fixed by changing this line:
This would mean that even if the secret name is changed or a custom secret is used, the value for the CFN MasterUsername field would remain the same as long as
masterUser.username
remains the same, meaning no replacement would be required.Unfortunately, this would be a breaking change as it would change the value of the MasterUsername field for existing clusters from the secret lookup to the string value, meaning existing clusters would require replacement after upgrading the CDK version. Because of this, it may only be able to be implemented in a DatabaseClusterV2 construct, but this issue should be kept in mind if such a construct is ever developed.
Additional Information/Context
No response
CDK CLI Version
2.115.0
Framework Version
No response
Node.js Version
20.11.1
OS
Windows 10 Enterprise
Language
TypeScript
Language Version
No response
Other information
No response
The text was updated successfully, but these errors were encountered: