Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: pull code from cdk-library #4

Merged
merged 6 commits into from
Apr 14, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 3 additions & 20 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,7 @@ import {
import { Construct } from 'constructs';
import { Namer } from 'multi-convention-namer';

// export interface DbUser {
// /**
// * The name of the dbUser.
// * Will be rendered in snake_case for the DB.
// */
// readonly name: Namer;
// /**
// * This only affects the default privileges grants inside the db.
// *
// * @default false by default a "reader"
// */
// readonly isWriter?: boolean;
// }
const passwordRotationVersion = '1.1.217';

export interface AuroraProps {
/**
Expand Down Expand Up @@ -127,11 +115,6 @@ export class Aurora extends Construct {
const instanceType =
props.instanceType || aws_ec2.InstanceType.of(aws_ec2.InstanceClass.T3, aws_ec2.InstanceSize.MEDIUM);

// const users: DbUser[] = props.users ?? [
// { name: new Namer(['reader']) },
// { name: new Namer(['writer']), isWriter: true },
// ];

const secretName = id.addSuffix(['manager']);

this.cluster = new aws_rds.DatabaseCluster(this, 'Database', {
Expand Down Expand Up @@ -176,7 +159,7 @@ export class Aurora extends Construct {
const managerRotation = this.cluster.addRotationSingleUser();
// https://github.com/aws/aws-cdk/issues/18249#issuecomment-1005121223
const managerSarMapping = managerRotation.node.findChild('SARMapping') as CfnMapping;
managerSarMapping.setValue('aws', 'semanticVersion', '1.1.217');
managerSarMapping.setValue('aws', 'semanticVersion', passwordRotationVersion);

// User management
// const serviceToken = core.Param.get(this, '', { rootId: 'infra', stackId: '', constructId: '' });
Expand Down Expand Up @@ -205,7 +188,7 @@ export class Aurora extends Construct {
const rotation = this.cluster.addRotationMultiUser(user.pascal, { secret });
// https://github.com/aws/aws-cdk/issues/18249#issuecomment-1005121223
const sarMapping = rotation.node.findChild('SARMapping') as CfnMapping;
sarMapping.setValue('aws', 'semanticVersion', '1.1.217');
sarMapping.setValue('aws', 'semanticVersion', passwordRotationVersion);
}
return secret;
});
Expand Down