import { Construct } from 'constructs'; import Secret from './Secret'; import { Password, PasswordConfig } from '../generated/providers/random'; import { getId } from '../utils'; type RandomSecretProps = PasswordConfig & { /** * @default 24 */ length?: number; }; export default class RandomSecret extends Construct { readonly value: string; constructor(scope: Construct, id: string, props?: RandomSecretProps) { super(scope, id); const password = new Password(this, 'password', { length: 24, ...props, }); const { value } = new Secret(this, getId('secret'), { secretString: password.result, }); this.value = value; } }