https://pulumi.com logo
n

nutritious-judge-27316

05/05/2020, 8:10 AM
hello, Do you know if it is possible in pulumi portal to hide Values of resources created. I don't really want some users to see the password.
l

limited-rainbow-51650

05/05/2020, 8:13 AM
By using
pulumi.secret
(JavaScript) or
pulumi.Output.secret
(Python) to take an existing value and wrap it up in an
Output
which is marked as a secret.
https://www.pulumi.com/blog/managing-secrets-with-pulumi/#output-and-secrets
👍 1
n

nutritious-judge-27316

05/05/2020, 8:45 AM
i will look for the c# alternative, thanks for the help
b

broad-dog-22463

05/05/2020, 12:02 PM
you can do this in C#
Copy code
var secret = new RandomPassword("my-random-password", new RandomPasswordArgs
                {
                    Length = 30,
                    Special = true,
                },
                new CustomResourceOptions
                {
                    AdditionalSecretOutputs = new List<string>
                    {
                        "result"
                    }
                });
👍 1
notice the CustomResourceOptions
h

hallowed-rain-9096

05/05/2020, 1:33 PM
stringly-typed API there 👎
would be great if you could do, say:
Copy code
var secret = new RandomPassword("my-random-password",
    new RandomPasswordArgs
    {
        Length = 30,
        Special = true,
    },
    new CustomResourceOptions<RandomPassword>()
        .AddSecretOutput(x => x.Result)
    );
Compiler errors are better than runtime errors if you misspell something 😉
b

broad-dog-22463

05/05/2020, 1:40 PM
If you'd like to open an issue to suggest it then please feel free to @hallowed-rain-9096 - I'm sure it's something that can be discussed
h

hallowed-rain-9096

05/05/2020, 1:49 PM
OK, fine... 🙄 😆 (kidding) https://github.com/pulumi/pulumi/issues/4566 would you mind reviewing this issue real quick @broad-dog-22463? Thanks!
b

broad-dog-22463

05/05/2020, 1:49 PM
looking right now
it's not going to be this
Copy code
new CustomResourceOptions<RandomPassword>() // specify generic for strong typing
        .AddSecretOutput(x => x.Result) // specify output via expression; typos yield compiler errors
    );
CustomResourceOptions has a LOT of things in it
h

hallowed-rain-9096

05/05/2020, 1:51 PM
is this the time to take this discussion over to GitHub so everyone can see the history?
b

broad-dog-22463

05/05/2020, 1:51 PM
maybe something like:
Copy code
var secret = new RandomPassword("my-random-password",
    new RandomPasswordArgs
    {
        Length = 30,
        Special = true,
    },
    new CustomResourceOptions
    {
        new AdditionalSecretOutputs<RandomPassword>()
          .AddOutput(x => x.Result
    }
h

hallowed-rain-9096

05/05/2020, 1:54 PM
the downside to that is I can oopsidentally put
AdditionalSecretOutputs<ResourceTypeOne>
into the
CustomResourceOptions
of a resource of type
ResourceTypeTwo
n

nutritious-judge-27316

05/05/2020, 1:54 PM
Got it working in the end. List string kind of threw me for a while. I am still quite new c#.