calm-quill-21760
02/24/2020, 5:34 PMreturn new Promise(resolve => return pulumi.output(variable_name).apply(val => {resolve (val);})
The returned object looks correct, though Typescript seems to have lost all concept of the object types being returned.
This makes me think about the AWS SDK where you can add .promise() to the end of a number of calls to work cleanly with await.
I'm far from being a Typescript guru, but how difficult is it to have something similar in Pulumi?white-balloon-205
await
syntax over other types of data.
Despite the analogy, note that in Pulumi, 90%+ of the time Output
is used quite differently than Promise
is used in other APIs. Outputs
are primarily data you pass from one place (the output of a resource) to another (the input of another resource), transforming the value along the way. This is different than common use of Promise
in may JS APIs where it is used for control-flow.
The result is that in common usage, you shouldn't need to use something like await
on Outputs, and indeed if it was available it would encourage patterns that are not ideal for Pulumi (like creating resources "inside apply", which can lead to inaccurate previews).calm-quill-21760
02/24/2020, 5:48 PMwhite-balloon-205
.all.apply
s to convert a set of outputs into a single input)?calm-quill-21760
02/24/2020, 5:53 PMwhite-balloon-205
calm-quill-21760
02/24/2020, 5:56 PMcalm-quill-21760
02/24/2020, 6:16 PMwhite-balloon-205
lukehoban
.calm-quill-21760
02/24/2020, 7:04 PM