https://pulumi.com logo
#typescript
Title
# typescript
g

gorgeous-animal-95046

12/19/2019, 3:23 PM
Hi I'm having some problems with
interpolate
and I can't figure out what I'm doing wrong. Here's my code: https://gist.github.com/zombor/43cd30735aa72bc02be4ef878aa073c6 I'm guessing this has to do with some kind of aysnc problem, but the docs on
interpolate
suggest this should "just work". Anyone know what I'm doing wrong? I would expect the output of
foo
on L25 to be either
undefined
or some kind of actual string.
t

tall-librarian-49374

12/19/2019, 3:31 PM
Your
apply
on line 24 and
interpolate
on line 29 aren't doing anything. You can just remove them with the same effect.
Apply returns an Output, so the console output makes sense
Your exports should be fine though
g

gorgeous-animal-95046

12/19/2019, 3:34 PM
this was just an example. my actual usage is a bit more complicated. I'm trying to match the role name in a loop in another part of my program. Shouldn't I be able to do an interpolate and assign to a variable then print it out?
t

tall-librarian-49374

12/19/2019, 3:36 PM
Generally, no. Interpolate returns another output, not a raw string. You can't convert any output to raw value: the value might not be known at the point when you ask.
g

gorgeous-animal-95046

12/19/2019, 3:37 PM
so is there any way that I can take a list like
["foo", "bar"]
and match them to an output value?
t

tall-librarian-49374

12/19/2019, 3:38 PM
You could do that inside
apply
g

gorgeous-animal-95046

12/19/2019, 3:39 PM
tries
yes, i think this is what I need. Thank you!