pulumi / actions

Deploy continuously to your cloud of choice, using your favorite language, Pulumi, and GitHub!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

passcod opened this issue · comments

Hello!

  • Vote on this issue by adding a đź‘Ť reaction
  • If you want to implement this feature, comment to let us know (we'll work with you on design, scheduling, etc.)

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

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

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

🤦‍♂️ 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?

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).