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

limited-farmer-68874

06/20/2023, 10:01 PM
Is there a way to check which Pulumi operation is occurring? AKA is this "pulumi up" or "pulumi preview", etc. I want to run a snippet of code ONLY on updates, for example.
e

echoing-dinner-19531

06/20/2023, 10:21 PM
For the nodejs SDK there's a isDryRun function: https://www.pulumi.com/docs/reference/pkg/nodejs/pulumi/pulumi/runtime/#isDryRun All the other sdks will have something similar.
f

fast-vr-6049

06/20/2023, 11:07 PM
For C#, you can use `Pulumi.Deployment`:
Copy code
if (Pulumi.Deployment.Instance.IsDryRun)
{
    // Dry-run only code goes here
}
2 Views