Skip to content

Commit

Permalink
add check to prevent defining conflicting properties
Browse files Browse the repository at this point in the history
  • Loading branch information
epoctic committed Nov 18, 2024
1 parent af4cd5d commit 952a95e
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions packages/aws-cdk-lib/aws-rds/lib/cluster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1188,6 +1188,20 @@ export class DatabaseCluster extends DatabaseClusterNew {
constructor(scope: Construct, id: string, props: DatabaseClusterProps) {
super(scope, id, props);

if (
props.manageMasterUserPassword &&
(
props.credentials?.excludeCharacters ||
props.credentials?.password ||
props.credentials?.replicaRegions ||
props.credentials?.secret ||
props.credentials?.secretName ||
props.credentials?.usernameAsString
)
) {
throw new Error('Only the `username` and `encryptionKey` credentials properties may be used when `manageMasterUserPassword` is true');
}

let cluster: CfnDBCluster;
if (!props.manageMasterUserPassword) {
const credentials = renderCredentials(this, props.engine, props.credentials);
Expand Down

0 comments on commit 952a95e

Please sign in to comment.