Hi, super nooby question. I need to access the ra...
# golang
Hi, super nooby question. I need to access the raw string value of a StringOutput to interpolate it into another string. The
function doesn't return a raw string. how can I do this? Small go snippet would be awesome.
oh I see, you can't ever get a handle on the string value in the top level scope unless you assign to a variable inside of the
function. Apply is mostly just used to transform `pulumi.StringOutput`s
You have to do in an async way. One way is to use a wait group and assign the inner apply value to an outside variable.
Copy code
var str string
var wg sync.WaitGroup
myPulumiOutput.ApplyT(func(s string) error {
  defer wg.Done()
  str = s
  return nil
It's from my phone so expect lots of errors, but that's the general idea
makes sense @brash-match-91530! thanks 🙂
@brash-match-91530 I'm actually not sure that would work, because Pulumi runs all your code first to create the DAG of resource dependencies. This would block that I think. @billowy-army-68599 am I correct?
@numerous-printer-41511 were you able to figure this out?