Good morning! I'm having a hard time to get value ...
# dotnet
Good morning! I'm having a hard time to get value of an
Copy code
var randomStringResult = string.Empty;
            var randomString = new RandomPassword("random", new RandomPasswordArgs() { Length = 63 }).Result.Apply(v => randomStringResult = v);
I'm probably missing something obvious here? I need to generate a random password and need access to the generated string result
it depends what you're using the generated result for
in general you'd use it within the actual apply method, but you shouldn't create new pulumi resources in there since they would be missing from any 'preview' steps
💯 1
It’s not possible, because the generated value won’t be known until
is done with this resource. Any usage of the value has to stay within
Speaking of
, is there a way to keep the previous generated password ? When I use
, each time I do a
pulumi up
a new password will be generated and my resources will all have to be updated even if nothing else has changed. I want to generate a password with radom instead of specifying one in my yaml stack file but I don't wan't it to change each time.
it should keep the generated password in the state file so that shouldn't happen