b

    blue-judge-71382

    3 months ago
    Anyone knows how to unsecret values of stack.outputs()? It seems pulumi.unsecret is used for config values. Thanks😃
    I didn't find any information on the Pulumi doc or google.
    Could anyone give an example?
    q

    quaint-eye-38036

    3 months ago
    pulumi stack output --show-secrets
    p

    prehistoric-activity-61023

    3 months ago
    if you want to show values that are secrets, use
    --show-secrets
    as @quaint-eye-38036 wrote
    if you want to convert some output that’s a secret to a plain value… I’ll have to think 🤔
    I’m checking if that works:
    # standard secret
    pulumi.export("sql_root_password", sql.root_user.password)
    
    # my attempt
    pulumi.export("sql_root_password_plain", pulumi.Output.unsecret(sql.root_user.password))
    I think it works just fine. The above snippet is for python so if you’re using some other lang, you should be able to find a counterpart function. Anyway,
    unsecret
    seems like a way to go 🙂.
    Saying that… I’m not sure it’s a good idea to unsecret secrets 😐. I’d think twice before doing it. If you want to check the secret values, you should leave them as they are but use
    --show-secrets
    . Within the code, you shouldn’t really need to unsecret them (just use them directly).
    b

    blue-judge-71382

    3 months ago
    Thank you guys! I am developing a web application for internal team to manage all the aws cloud resources including IAM, CodeCommit etc. When I create a IAM user with Git credentials, I need to know the plaintext git password to use. Do you have the same situation?
    async getStackOutputs(
    projectName: string, stackName: string, stackType: InfrastructureStackType ) { // [step 1] Create stack args. const args: InlineProgramArgs = { projectName, stackName, program: async () => {}, }; // [step 2] Get stack. const stack = await LocalWorkspace.selectStack(args); await stack.workspace.installPlugin(‘aws’, this.pulumiAwsVersion); await stack.setAllConfig({ ‘aws:region’: {value: this.awsRegion}, ‘aws😛rofile’: {value: projectName}, }); // [step 3] Get stack outputs. const outputs = await stack.outputs(); const outputKeys = this.getStackServiceByType(stackType)?.getStackOutputKeys(); return outputKeys?.map(key => { if (outputs[key].secret) { return {[key]: pulumi.unsecret(outputs[key].value)}; } else { return {[key]: outputs[key].value}; } }); }