Skip to content

Commit

Permalink
rds secret discovery
Browse files Browse the repository at this point in the history
  • Loading branch information
williamputraintan committed Jan 30, 2024
1 parent 824b22d commit e3bee77
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions config/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { Duration, aws_lambda } from 'aws-cdk-lib';
const regName = 'OrcaBusSchemaRegistry';
const eventBusName = 'OrcaBusMain';
const lambdaSecurityGroupName = 'OrcaBusLambdaSecurityGroup';
const rdsMasterSecretName = 'orcabus/rds-master'; // pragma: allowlist secret

const orcaBusStatefulConfig = {
schemaRegistryProps: {
Expand All @@ -25,6 +26,7 @@ const orcaBusStatefulConfig = {
parameterGroupName: 'default.aurora-postgresql15',
username: 'admin',
dbPort: 5432,
masterSecretName: rdsMasterSecretName,
monitoring: {
cloudwatchLogsExports: ['orcabus-postgresql'],
},
Expand Down Expand Up @@ -57,6 +59,7 @@ const orcaBusStatelessConfig = {
lambdaSecurityGroupName: lambdaSecurityGroupName,
lambdaRuntimePythonVersion: aws_lambda.Runtime.PYTHON_3_10,
bclConvertFunctionName: 'orcabus_bcl_convert',
rdsMasterSecretName: rdsMasterSecretName,
};

interface EnvironmentConfig {
Expand Down
1 change: 1 addition & 0 deletions lib/workload/orcabus-stateless-stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export interface OrcaBusStatelessConfig {
lambdaSecurityGroupName: string;
lambdaRuntimePythonVersion: aws_lambda.Runtime;
bclConvertFunctionName: string;
rdsMasterSecretName: string;
}

export class OrcaBusStatelessStack extends cdk.Stack {
Expand Down
2 changes: 2 additions & 0 deletions lib/workload/stateful/database/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export type DatabaseProps = MonitoringProps & {
defaultDatabaseName: string;
parameterGroupName: string;
username: string;
masterSecretName: string;
version: rds.AuroraPostgresEngineVersion;
numberOfInstance: number;
minACU: number;
Expand All @@ -47,6 +48,7 @@ export class DatabaseConstruct extends Construct {

const dbSecret = new rds.DatabaseSecret(this, id + 'DbSecret', {
username: props.username,
secretName: props.masterSecretName,
});

this.dbSecurityGroup = new ec2.SecurityGroup(this, 'DbSecurityGroup', {
Expand Down

0 comments on commit e3bee77

Please sign in to comment.