https://pulumi.com logo
Title
s

salmon-motherboard-78006

11/16/2022, 8:38 PM
hi all, how can I get the
id
of a specific Pulumi run/exeuction? Let’s say I run
pulumi up
I’m sure there is a unique ID attached to this run, how can I grab it?
l

little-cartoon-10569

11/16/2022, 8:41 PM
If you're running via the Pulumi service, you can use its API: https://www.pulumi.com/docs/reference/service-rest-api/#list-stack-updates
But I don't know how to do it via the automation-api. I think it's unlikely to be available within a Pulumi program.
s

salmon-motherboard-78006

11/16/2022, 8:42 PM
I see thanks
I thought to grab some Stack ID similar to how Cloud Formation does it
l

lively-needle-84406

11/16/2022, 9:32 PM
@salmon-motherboard-78006 If you want to grab this ID manually, you can look at the terminal output. When
pulumi up
is ran, the live preview link is displayed. The id of the run should be the uuid appended to the end of the link.
s

salmon-motherboard-78006

11/16/2022, 9:37 PM
Thanks… but I need the id as part of the code (e.g. trying to create a LogGroup with the id)…
l

little-cartoon-10569

11/16/2022, 9:42 PM
You cannot create any resource with a Pulumi name that is not known at runtime. async values, or anything retrieved from the cloud, cannot be used, unless they are retrieved in advance and passed into the program.
So a dynamically-generated stack ID is not suitable for this use.
Maybe maintain your own ID? Perhaps your build system / yarn could create it and pass it in?
s

salmon-motherboard-78006

11/16/2022, 9:43 PM
ok got it… will just generate a UUID as a sudo solution