hello, Do you know if it is possible in pulumi por...
# general
n
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
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
i will look for the c# alternative, thanks for the help
b
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
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
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
OK, fine... 🙄 😆 (kidding) https://github.com/pulumi/pulumi/issues/4566 would you mind reviewing this issue real quick @broad-dog-22463? Thanks!
b
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
is this the time to take this discussion over to GitHub so everyone can see the history?
b
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
the downside to that is I can oopsidentally put
AdditionalSecretOutputs<ResourceTypeOne>
into the
CustomResourceOptions
of a resource of type
ResourceTypeTwo
n
Got it working in the end. List string kind of threw me for a while. I am still quite new c#.