Is there a way to check which Pulumi operation is ...
# general
l
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
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
For C#, you can use `Pulumi.Deployment`:
Copy code
if (Pulumi.Deployment.Instance.IsDryRun)
{
    // Dry-run only code goes here
}