Hi everyone, I suspect my question went unnoticed ...
# general
Hi everyone, I suspect my question went unnoticed so I’m bumping it, and clarifying a bit. I’m looking for a way to create a new stack as part of a DevOps pipeline. The stack name could for example be input using a user-configurable pipeline variable, or it could be the name of the branch that triggered the build. I want to use the Pulumi Task Extension for Azure Pipelines to initialize a new stack if it does not already exist. The obvious thing to try is to use set
command: stack
options: init $(StackName)
in the YAML. However, the
task has a mandatory
parameter, and the task always tries to select that stack the first thing it does, before it proceeds to execute the actual command, which of course results in an error because the stack does not yet exist.
cc @clever-sunset-76585 again 🙂
Ah yes. I thought about making the stack input optional for this very reason, but didn't because well it hadn't come up till now. Mind opening an issue?
@clever-sunset-76585 Sure - what’s the repo?
@clever-sunset-76585 wouldn’t it make more sense if the
parameter remained required, and you added a
stack init
command to the task, that uses this parameter for the stack init, but does not try to do the select first?
Such a
stack init
command could then also “swallow” the error that occurs if the stack already exists. Something we would otherwise need to do in the pipeline.
Yep that’s what I am thinking too. There is a need for an “ephemeral” stack capability in Pulumi itself and I think there is an issue open in
. I implemented a similar thing for our Octopus Deploy Step Template too. It allows you to create a stack of if it does not exist.
+1 for this