https://pulumi.com logo
e

elegant-crayon-4967

08/13/2019, 6:19 PM
trying to get a secret from
aws.secretsmanager
but the documentation has me confused on how I actually pass the secret into my resource. Anybody have an example?
w

white-balloon-205

08/13/2019, 8:28 PM
When you say "get a secret" - what did you have in mind exactly?
e

elegant-crayon-4967

08/14/2019, 4:21 PM
Mike had helped me a bit in a separate channel, but the following is the code I have...
Copy code
const adSecret = pulumi.output(aws.secretsmanager.getSecret({
  name: 'ad/password',
}));

const adPassword = adSecret.id.apply(id =>
    aws.secretsmanager.getSecretVersion({
      secretId: id,
    })
);

const adPasswordString = adPassword.secretString.apply(passwd => 
  {
    return JSON.parse(`${passwd}`).Password;
  }
 );
I don't know how to properly store the password into a variable to use later