https://pulumi.com logo
f

full-dress-10026

11/27/2018, 9:57 PM
I have two Pulumi resources, call them
pA
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. Is it possible to do this with Pulumi?
i

incalculable-sundown-82514

11/27/2018, 10:00 PM
It is possible, but in general we don’t have a good solution for this. The main problem is that Pulumi currently doesn’t have a way to “hook in” to another resource’s lifecycle and only run something when a resource is created or replaced. It’s definitely something that we want to do, though, since it’s a killer feature.
m

microscopic-florist-22719

11/27/2018, 10:02 PM
FWIW, if the CLI bits you need to run are idempotent, you can work around this limitation using an
apply
i

incalculable-sundown-82514

11/27/2018, 10:02 PM
^ true.
m

microscopic-florist-22719

11/27/2018, 10:04 PM
you can avoid running the code during a preview by early-returning from the
apply
if
pulumi.runtime.isDryRun()
is
true
f

full-dress-10026

11/27/2018, 10:05 PM
Hmm, it's not idempotent by default but it might be possible to make it that way. Thanks for the pointers. This feature would indeed be killer.
If I throw an exception in an
apply
, will the update be cancelled?
m

microscopic-florist-22719

11/27/2018, 10:50 PM
Yes
Any uncaught exception will kill the update
👌 1
f

full-dress-10026

11/28/2018, 2:06 AM
How would I ensure that my CLI stuff in the
apply
completes before the
pB
?