https://pulumi.com logo
b

breezy-butcher-78604

04/30/2021, 3:19 AM
why does requiring stack outputs return an
Output<T>
instead of just
T
or
Promise<T>
? stack outputs will be known at preview time but since they return
Output<T>
i can't use those values until deploy time
r

red-match-15116

04/30/2021, 3:21 AM
Output<T> is essentially like Promise<T>. Except that instead of
.then()
you have to use
.apply()
to access the unwrapped value.
b

breezy-butcher-78604

04/30/2021, 3:24 AM
yeah i know, but the output of an
apply
is another
Output<T>
whereas with a promise I can
await
it and access the underlying value at preview time
r

red-match-15116

04/30/2021, 3:25 AM
You can still access the value of Output at preview time if the value is known
You just have to do it within the apply
Is there something that isn’t doing what you expect?
b

breezy-butcher-78604

04/30/2021, 3:47 AM
let me throw together some example code
l

little-cartoon-10569

04/30/2021, 3:48 AM
I don't think you can guarantee that stack outputs will be known at preview time. It wouldn't be safe to assume that the outputting stack is not currently being deployed...
Or even that the stack is local / on your machine. You could (and frequently, are) getting those outputs from a stack at api.pulumi.com or S3. These have the same async requirements as deploying to a remote API or S3...
b

breezy-butcher-78604

04/30/2021, 3:51 AM
yeah that makes sense but wouldn't that same issue occur at deploy time too? ie if I'm deploying a resource in
Stack A
using a stack output from
Stack B
, what happens if
Stack B
is deploying while
Stack A
is using that output?
how does
requireOutput()
behave in that scenario?
l

little-cartoon-10569

04/30/2021, 3:52 AM
I, for one, am happy to trust our new Pulumi overlords! (that it'll be alright once Pulumi looks after resolving dependencies)
🪄 1
partypus 8bit 1