https://pulumi.com logo
#general
Title
# general
b

busy-umbrella-36067

10/25/2018, 7:09 PM
this may just be a general JS question. any idea how one would generate a random string as a k8s secret on creation, but avoid recreating it every time? (with pulumi)
b

big-piano-35669

10/26/2018, 3:54 AM
@busy-umbrella-36067 We just today published our new
@pulumi/random
provider, which will generate a random string in a way that works well with the Pulumi model (i.e., only the first time the stack is created, not every time).
This file https://github.com/pulumi/pulumi-random/blob/master/examples/simple/index.ts shows some example usages of the various resources in there, but let's say you wanted to create a string containing 64 random characters. You could do so as follows:
Copy code
import * as random from "@pulumi/random";
export const randomChars =
    new random.RandomString(
        "randomChars", { length: 64 }).result;
b

busy-umbrella-36067

10/26/2018, 1:38 PM
@big-piano-35669 that's awesome! Thanks for the follow up
2 Views