full-dress-10026
11/28/2018, 6:04 PMpA
and pB
, that need to be deployed. Before pB
can be deployed, I have some custom CLI stuff that needs to be run that depends on pA
outputs. I understand that right now it's not possible to hook into the lifecycle, and that it will likely be added as a feature in the future. As a workaround for now, I was told I could run the CLI stuff in an apply
that contains pA
outputs. How would I ensure that pB
does not start provisioning until the CLI stuff running in the apply
completes without exception?microscopic-florist-22719
apply
as an input to pB
.gate
is the apply
you want to gate on and foo
is the actual input you need, you can do this;const gate = /* some apply */;
const foo = /* some value */;
const pB = new B("b", {
...
input: pulumi.all([foo, gate]).apply(([f]) => f);
});
full-dress-10026
11/28/2018, 7:26 PMB
doesn't need to use the output of pulumi.all
?microscopic-florist-22719
B
have any inputs? If so, you can mix it into one of thosefull-dress-10026
11/28/2018, 7:28 PMmicroscopic-florist-22719
all
is in there is to ensure that the apply has finished before pB
is createdconst pB = new B("b", {
...
input: someInput,
});
apply
that needs to run before pB
is registered:const gate = pA.foo.apply(foo => ...);
const pB = new B("b", {
...
input: pulumi.all([someInput, gate]).apply(([i]) => i),
});
full-dress-10026
11/28/2018, 7:32 PMmicroscopic-florist-22719
full-dress-10026
11/28/2018, 7:39 PMfunction waitForDatomic<T>(val: T): pulumi.Output<T> {
return pulumi.all([val, datomicGate]).apply(([v]) => v);
}
pulumi.all
returns Output<Unwrap<T>>
. Not sure what the Unwrap
does...microscopic-florist-22719
Unwrap
does is "it's complicated" 🙂. @lemon-spoon-91807 can provide a longer answer.full-dress-10026
11/28/2018, 8:09 PMUnwrap
type declared?lemon-spoon-91807
11/28/2018, 8:10 PMfull-dress-10026
11/28/2018, 8:11 PMlemon-spoon-91807
11/28/2018, 8:11 PMfull-dress-10026
11/28/2018, 8:11 PMpulumi.Unwrap
.lemon-spoon-91807
11/28/2018, 8:11 PM{ foo: Promise<number>, bar: Promise<Promise<bool>[]> }
{ foo: number, bar: bool[] }