Skip to content

Commit

Permalink
rename credential
Browse files Browse the repository at this point in the history
  • Loading branch information
williamputraintan committed Mar 12, 2024
1 parent bb18178 commit d0f67ef
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/workload/stateless/postgres_manager/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ There are 4 lambdas in this stack:

Create a role with login credentials used for this microservice.
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 d0f67ef

Please sign in to comment.