pulumi: Option to disable new stack prompt (if stack does not exist), just fail instead

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

When running commands like pulumi preview against a stack that doesn’t exist, I’m prompted to create the stack. I’d rather see this fail, but I don’t have a way to handle this.

Affected area/feature

CLI

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Reactions: 1
  • Comments: 22 (16 by maintainers)

Most upvoted comments

I really have no opinion on the interactive mode. I use it only in very simple, experimental situations. But I agree that tools like Pulumi should not force usage patterns. Suggest and recommend, sure, but don’t compel.

So, I’ll be honest here, I didn’t actually verify that --stack nonexistent --non-interactive --yes didn’t create a stack. The signifiers I got from running with --stack nonexistent separately from --non-interactive --yes lead me to write this issue, thinking that --yes would answer yes to the would you like to create this stack? prompt.

This right here demonstrates why this issue should be addressed. Your intuition is completely reasonable. The behavior of the command is not.

Oh wow. Ok so, actually the problem is not only in the interaction but the actual behavior too.

So, I’ll be honest here, I didn’t actually verify that --stack nonexistent --non-interactive --yes didn’t create a stack. The signifiers I got from running with --stack nonexistent separately from --non-interactive --yes lead me to write this issue, thinking that --yes would answer yes to the would you like to create this stack? prompt.

So at this point, I see several problems. Inconsistent behavior with the --yes and the undesired “convenience” function, when in interactive mode.

@ghostsquad I still don’t understand your use case. I can think of two situations:

  1. pulumi is being run from a script: If a valid stack is not selected, or if the --stack flag is passed and points to a non-existent stack then the command errors. You are not prompted. I include this case since you mention automation, but we don’t prompt when --non-interactive is passed.
  2. You are running pulumi manually: I understand that pressing^C is annoying, but it sounds like it doesn’t block any workflow. If you want to confirm a stack exists before running pulumi up you can use pulumi stack select, which will error on a missing stack. Do the semantics of pulumi stack select <stack> && pulumi up do what you want us to do?