Hello. I”m looking for some guidelines here. I’m u...
# general
m
Hello. I”m looking for some guidelines here. I’m using Pulumi to set up VMs for running my experiments. I have multiple VMs running in parallel, and I could call the pulumi run command multiple times from different VMs to run multiple experiments in parallel, or on the same vm, run multiple experiments in parallel, by calling pulumi up while the stack created some resources for another experiment that is still running. If I try to reuse the same stack across experiments, the stack either updates an existing set of resources it created, or it destroys any existing resources it previously created for another experiment that is still running. So, for each experiment, I’m creating a new stack and then deleting the stack at the end of the experiment. Is this the right way to do this? Is there a better way to do it?
l
Pulumi isn't the right tool to run stuff in your VMs. Pulumi is for creating the VMs, configuring their boot instructions, and things like that.
m
Oh. I’m not running anything using Pulumi. I’m using another library meant to run remote commands for that. I’m more specifically talking about the stack part. Should I create a new stack for each experiment or is there a way I can call pulumi up twice and not have the stack destroy the previous resources?
l
Ah right. That's the right way to do it using "vanilla" Pulumi. You can get much fancier than that with automation-api.
You can, for example, dynamically create stacks and choose at run time whether to refresh/re-up an existing stack, or create a new stack.
m
Ah. Okay. That answers my question. Thank you very much! 🙂
l
You could also use a single stack and dynamically add resources to it (in loops / conditionals), but the automation-api solution is better.
m
Yes. The automation-api is what I’m using right now.
l
Once you wrap it in a handy self-serve web page, and associate an experiment name with a stack, then you'll stop worrying about stacks and learn to love the bomb automation.
❤️ 1
m
I’m already loving it. 🙂
ham dance 1