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

bitter-island-28909

03/05/2019, 4:26 PM
is there a recommended way to run some imperative code after creating a resource? (e.g, ssh into an instance and run a script?)
It actually works fine to just do what I want inside an
.apply
function, but it executes every time I run pulumi, not just when I say “yes” to performing an update.
w

white-balloon-205

03/05/2019, 4:41 PM
You can use
pulumi.runtime.isDryRun
to test whether a preview is being run and only run some code if it is not a preview (aka "dry run"). The richest way to do this is with Dynamic Providers, which let you define your own Create, Read, Update and Delete steps for some virtual "resource" in JavaScript. This is very flexible, but quite low level currently and not yet well documented (docs coming soon). But right now, an
.apply
with
isDryRun
should generally work well in many cases.
b

bitter-island-28909

03/05/2019, 4:42 PM
cool, thank you!
looking forward to those docs on Dynamic Providers, sounds super powerful
2 Views