Skip to content

(docdb): It should be possible to change the secretName for the created secret #17572

@markussiebert

Description

@markussiebert

Description

At the moment, a secret will be created for the docdb if only the username is specified. This is fine, but it would be nice, if it's possible to change the secretname.

Use Case

We grant our projects IAM permissions to read/write secrets on paths on secretsmanager. The autogenerated names don't match on the paths we allow them to access.

Proposed Solution

Add a property

export interface Login {
  /**
   * The name of the secret that will be created
   * @default undefined
   */
   readonly secretName?: string;
   ...

and change this accordingly

 // Create the secret manager secret if no password is specified
    let secret: DatabaseSecret | undefined;
    if (!props.masterUser.password) {
      secret = new DatabaseSecret(this, 'Secret', {
        username: props.masterUser.username,
        encryptionKey: props.masterUser.kmsKey,
        excludeCharacters: props.masterUser.excludeCharacters,
        secretName: props.masterUser.secretName, //added 
      });
    }

Other information

that's it

Acknowledge

  • I may be able to implement this feature request
  • This feature might incur a breaking change

Metadata

Metadata

Assignees

No one assigned

    Labels

    @aws-cdk/aws-docdbRelated to Amazon DocumentDBeffort/smallSmall work item – less than a day of effortfeature-requestA feature should be added or improved.in-progressThis issue is being actively worked on.p1

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions