Hi Does anyone know if it's possible to get the c...
# golang
b
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
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
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
@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
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.