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

bored-river-53178

07/22/2019, 1:01 AM
how can I get an Output value from StackReference? When I try to use get() on it, there is an error 'Error: Cannot call '.get' during update or preview.', but it doesn't make sense to me, why it's not possible to do that?
c

crooked-jordan-34725

07/22/2019, 5:48 AM
have you tried using
.apply(f)
? At update time, f will be called with the realized value. eg:
stackref.apply((actualStackRef) => { do_something_with(actualStackRef) })
b

bored-river-53178

07/22/2019, 6:07 AM
But the result is still of the type Output, isn't it? So I still can't get the underlying value from it
I just don't understand why it's not possible to get values from the Outputs of another stack (which are already fully known and the start of 'pulumi up')
h

high-translator-22614

07/22/2019, 6:28 PM
Output.apply()
will call the function with the real value
but i'm guessing what you actually mean is "`StackReference.get()` throws an error instead of returning an
Output
)