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

busy-pizza-73563

03/27/2019, 10:40 PM
How can I get the underlying value of an
Output
?
b

bitter-oil-46081

03/27/2019, 10:51 PM
You can not get at the raw value during a
pulumi update
because in some cases it may not be known (for example, during a preview). You can, however, take any Output<T> and call .apply on it. Apply takes a function which gets the underlying value and allows you to transform it and then wraps the result in an Output<T>.
If you are capturing an output in like a cloud function and need the underlying value, you can call .get() on it, which gives you the raw value
but .get() will throw if you call it during a pulumi update.
If you want to log some value, to help debugging you can do: (<some-output>).apply(console.log); To log the value, but, if the value is not known (again, during a preview, for example) the apply simply won't run.
b

busy-pizza-73563

03/27/2019, 10:55 PM
Thanks, somehow I figured that out in the meanwhile. 🙂
p

proud-artist-4864

03/28/2019, 7:31 AM
The actual raw value is only available in JS/TS, in Python it can only be an Input to another Pulumi resource.