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

rapid-lamp-57703

03/18/2020, 12:17 PM
how do i access the value behind an Output?
b

broad-helmet-79436

03/18/2020, 12:34 PM
with the apply function
typescript:
Copy code
const newOutput = theOutput.apply(theValue => {
 do whatever you want with value
})
r

rapid-lamp-57703

03/18/2020, 12:46 PM
I saw that, thanks... i don't think it'll do what i need.
I want to return a list of uris for uploaded blobs in an Output i think that needs to be an Output<ImmutableArray<string>> NOT Output<ImmutableArray<Output<string>>> so to do that i need to access the string behind Blob.SourceUri...
w

white-balloon-205

03/18/2020, 3:26 PM
In general
.all
should let you turn an array of ourputs into an output of an array - which sounds like what you are looking for?
r

rapid-lamp-57703

03/18/2020, 4:07 PM
.All would let me apply something on all the elements yes, but if i have Output<string> how do i then turn that into just a string?
m

miniature-musician-31262

03/18/2020, 4:23 PM
pulumi.all().apply() will give you the strings of those outputs as an array of just-strings. It might be easier to go into more detail if you could share a snip if your code, though, assuming you’ve tried that already.
r

rapid-lamp-57703

03/18/2020, 4:45 PM
I've achieved what i wanted to do by changing the types within my array from Output<string> to object? eg public Output<ImmutableArray<object?>> UploadedUri { get; set; } instead of public Output<ImmutableArray<Output<string>> UploadedUri { get; set; }
it seems to be the way as the examples return dicts of <string, object?> - it is quite messy.... but works i guess