Skip to content

Using random resource in plans with Go? #9207

Discussion options

You must be logged in to vote

Resource's logical names currently have to be string, not Output<string> (see #5234). So that limits the use of the random provider for names a lot.

There are three things you could do:

  1. Just do the randomness outside pulumi and pass it in as config
  2. Call into the random provider at the start of your program and then do the rest of your program inside an apply. This causes some confusion at preview time because preview won't initially run the code inside apply but up will.
  3. Just copy the logic from the random provider into your code, and give it a deterministic seed (for example the hash of your stack name). The random pet code is just calling into https://github.com/dustinkirkland/golang-p…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@sheldonhull
Comment options

Answer selected by katcosgrove
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants