You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It creates a promise that resolves to the value of the output. However, the callback inside apply is only executed when the output is known which is usually the case during pulumi up. During pulumi preview, await getValue(...) will never resolve for an unknown value and your program will hang.
Writing such a function requires that you also provide a default value when the output is unknown and returning it. You also lose the "secretness" information and the dependencies of the output when you await the value.
Generally this goes against the programming model of Pulumi where outputs flow from start to finish, applying transformations using Apply when necessary. However, we do acknowledge that it isn't the most straightforward way to write programs and we implemented Output helper functions (for example #12519) to them easier to work with.
Is there a specific piece of code you have that you are trying to simplify, we can have a look.
Yeh this is pretty unsafe. If an output is unknown the promise will just never resolve.
Further this drops all information about if the value should be secret and loses all the resource dependency information that's used to ensure deletes happen in the right order.
We understand that outputs are the hardest part of the Pulumi programming model, but they are not promises and trying to handle them with await just brings about a different set of more subtle problems.
See this repo: https://github.com/LEGO/pulumi-get-value
I think this should be supported by Pulumi out of the box, both for dotnet and JavaScript (all languages supporting promises).
It can really make the call chain super clean, and make it easier to understand.
The text was updated successfully, but these errors were encountered: