is there a recommended way to run some imperative ...
# general
b
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
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
cool, thank you!
looking forward to those docs on Dynamic Providers, sounds super powerful