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
Apply
function. Apply is mostly just used to transform `pulumi.StringOutput`s
b
brash-match-91530
06/30/2021, 1:54 PM
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
wg.Add(1)
myPulumiOutput.ApplyT(func(s string) error {
defer wg.Done()
str = s
return nil
})
wg.Wait()
It's from my phone so expect lots of errors, but that's the general idea
b
bright-sandwich-93783
06/30/2021, 11:03 PM
makes sense @brash-match-91530! thanks 🙂
bright-sandwich-93783
06/30/2021, 11:06 PM
@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?
e
eager-vase-43200
10/05/2021, 12:46 AM
@numerous-printer-41511 were you able to figure this out?
No matter how you like to participate in developer communities, Pulumi wants to meet you there. If you want to meet other Pulumi users to share use-cases and best practices, contribute code or documentation, see us at an event, or just tell a story about something cool you did with Pulumi, you are part of our community.