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 Aug 5, 2024
1 parent 3909d7e commit 6f1d7d1
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 @@ -1099,6 +1099,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 6f1d7d1

Please sign in to comment.