Skip to content

Commit 03b654f

Browse files
authored
fix: warning should fire when both proxy and multiuser rotation enabled (#66)
1 parent 2b0543b commit 03b654f

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

src/aurora.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ export class Aurora extends Construct {
257257
constructor(scope: Construct, id: Namer, props: AuroraProps) {
258258
super(scope, id.pascal);
259259

260-
if (!props.skipAddRotationMultiUser && props.skipProxy) {
260+
if (!props.skipAddRotationMultiUser && !props.skipProxy) {
261261
Annotations.of(this).addWarning(
262262
'AWS RDS Proxy is fundamentally incompatible with the MultiUser rotation scheme. Please see README.md for more information.',
263263
);

test/aurora.test.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ let stack: Stack;
3030
let kmsKey: IKey;
3131
let vpc: IVpc;
3232
let template: Template;
33+
let annotations: Annotations;
3334
let defaultAuroraProps: AuroraProps;
3435
let aurora: Aurora;
3536

@@ -39,6 +40,7 @@ const createAurora = function (props?: AuroraProps) {
3940
...props,
4041
});
4142
template = Template.fromStack(stack);
43+
annotations = Annotations.fromStack(stack);
4244
};
4345

4446
describe('Aurora', () => {
@@ -167,6 +169,24 @@ describe('Aurora', () => {
167169
defaultAuroraProps = { databaseName, kmsKey, vpc };
168170
});
169171

172+
describe('multiuser rotation and proxy incompatibility', () => {
173+
const incompatibilityWarning = Match.stringLikeRegexp(
174+
'AWS RDS Proxy is fundamentally incompatible with the MultiUser rotation scheme.',
175+
);
176+
it('warns when both are enabled', () => {
177+
createAurora(defaultAuroraProps);
178+
annotations.hasWarning('*', incompatibilityWarning);
179+
});
180+
it('does not warn when multiuser rotation disabled', () => {
181+
createAurora({ ...defaultAuroraProps, skipAddRotationMultiUser: true });
182+
annotations.hasNoWarning('*', incompatibilityWarning);
183+
});
184+
it('does not warn when proxy disabled', () => {
185+
createAurora({ ...defaultAuroraProps, skipProxy: true });
186+
annotations.hasNoWarning('*', incompatibilityWarning);
187+
});
188+
});
189+
170190
it('activityStream', () => {
171191
const postgresEngineVersion = AuroraPostgresEngineVersion.VER_11_16;
172192
createAurora({ ...defaultAuroraProps, activityStream: true, postgresEngineVersion });

0 commit comments

Comments
 (0)