https://pulumi.com logo
Title
b

billions-wolf-76466

05/21/2022, 5:26 PM
Hi Does anyone know if it's possible to get the command that was run within my application? I'm adding some telemetry to track deployments etc and I'd like to know if someone ran
pulumi up
or
pulumi preview
g

gray-sunset-39305

05/24/2022, 2:10 AM
Hey Chris, Have you seen the Activity Dashboard? It may have what you're looking for. There's also the Pulumi Service REST API that has similar details: https://www.pulumi.com/docs/reference/service-rest-api/
b

billions-wolf-76466

05/24/2022, 9:03 AM
I don't think that quite gets what I want unless the API is updated before my code is run. What I'm hoping to do is run
pulumi preview
and within my code that defines the infra know that it was
preview
that was ran, or
up
or
destory
or whatever else. I couldn't see anything showing that was possible but I wasn't sure if I was missing something.
👍 1
o

orange-policeman-59119

05/27/2022, 4:01 AM
@billions-wolf-76466 the "Dryrun" property is available in every SDK on the context (Go) or a function on the Pulumi package. It returns true if you're in a preview, or false if it's a real deploy. On destroy, your Pulumi program doesn't run. Destroy works from all of the resources in the state of the stack, using the dependencies recorded in the state to destroy resources in reverse order.
b

billions-wolf-76466

05/27/2022, 8:25 AM
Thanks, I found that after asking on twitter too. Though I didn't know destroy didn't run my program but I guess it makes sense since it's not really needed for that.