Using the CLI, is it possible to tell if a given s...
# general
Using the CLI, is it possible to tell if a given stack exists? Similarly, can I check if a given stack is currently "leased"?
I'm using pulumi to deploy instances of our app for PRs; I have a script that runs when the PR is first opened and on each update. In all cases I'm creating (or updating) a stack specific to that PR.
I'd like to know if a stack exists yet because I have to run
at least once. Right now, I run it everytime but trap the error in cases where the stack already exists.
You can run
pulumi stack
and check the output to see if any resources are allocated for it
Not sure that will work when the stack doesn't exist. I get a terminal prompt asking if I want to create the stack. I don't know the behavior when their isn't a tty (i.e., running in a CI environment).
I'd like to know if the stack is currently being updated because I'd like to bail out of the deployment script early if that's the case.
I don’t believe there are ways to do this in the
CLI today, short of running a command and grepping for specific error messages / exit codes. (You can set an environment variable
, which will skip interactive prompts.) But this is a good suggestion, as we’d like to better this type of scenario. Could you please file an issue on If we can’t think of a good UX for adding a command-line verb, at the very least we can probably add an endpoint to our REST API that you can script using
👍 1