pulumi / actions

Deploy continuously to your cloud of choice, using your favorite language, Pulumi, and GitHub!
Apache License 2.0
249 stars 73 forks source link

Provide option to not fail a destroy when the stack doesn't exist #1001

Open passcod opened 1 year ago

passcod commented 1 year ago

Hello!

Issue details

We have a workflow that destroys a Pulumi stack when a PR is closed. However, not all PRs get deployed. For those, the destroy workflow fails. While not critical, this is still annoying and means if there's an actual error, it likely won't be caught as people are effectively trained to ignore errors on this workflow.

We'd like to have an option, eg ignore-missing-stack: boolean that does exactly this.

Affected area/feature

Frassle commented 1 year ago

Would it be possible to run a "pulumi stack select" first and if that fails ignore and skip the destroy? Or (maybe in conjunction with the above) we make the exit code for a stack not found error something specific, so you could do like:

pulumi destroy
EC=$?
if $EC -eq 404; then
  echo "stack missing, ignore"
else
  exit $EC
fi
passcod commented 1 year ago

I mean this issue is specifically about the action; if I was using the CLI directly I would have it solved already.

Frassle commented 1 year ago

🤦‍♂️ I didn't even notice what repo I was in.

Yes something like this sounds reasonable. I think the only question is if this flag should only apply to destroy actions, or also to updates?

passcod commented 1 year ago

Ah, yes I suppose it could also apply to updates, so long as upsert isn't given (both as it's nonsensical and also to avoid passing if the stack create fails for some reason).