Skip to content

Commit

Permalink
Postgres Manager Enhancement (#149)
Browse files Browse the repository at this point in the history
  • Loading branch information
williamputraintan authored Mar 13, 2024
1 parent bb18178 commit 1ce799b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
4 changes: 2 additions & 2 deletions lib/workload/stateless/postgres_manager/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ There are 4 lambdas in this stack:

2. `orcabus-create-pg-login-role`

Create a role with login credentials used for this microservice.
Create a role with login credentials used for the microservice to use.
The name of the role would be the microservice name itself, and the credential will be saved into the secret
manager. The secret manager name is saved to `orcabus/microservice/${microserviceName}`.
manager. The secret manager name is saved to `orcabus/${microserviceName}/rdsLoginCredential`.

Note: this will only work if the DbAuthType is configured to `USERNAME_PASSWORD`.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export const handler = async (event: EventType) => {
await pgClient.end();

// store the new db config at secret manager
const secretName = `orcabus/${microserviceName}/rdsLoginCredential`; // pragma: allowlist secret
const secretValue = createSecretValue({
password: password,
host: pgMasterConfig.host,
Expand All @@ -60,7 +61,7 @@ export const handler = async (event: EventType) => {
});

const smInput: CreateSecretCommandInput = {
Name: `orcabus/microservice/${microserviceName}`,
Name: secretName,
Description: `orcabus microservice secret for '${microserviceName}'`,
SecretString: JSON.stringify(secretValue),
Tags: [
Expand All @@ -71,9 +72,7 @@ export const handler = async (event: EventType) => {
};
const smCommand = new CreateSecretCommand(smInput);

console.info(
`storing the role credential at the secret manager (orcabus/microservice/${microserviceName})`
);
console.info(`storing the role credential at the secret manager (${secretName})`);
const response = await smClient.send(smCommand);
console.info(`ssm-response: ${JSON.stringify(response, undefined, 2)}`);
};
Expand Down

0 comments on commit 1ce799b

Please sign in to comment.