I’m looking to use pulumi as part of my CI to spin...
# general
w
I’m looking to use pulumi as part of my CI to spin up instances and test code as part of the pipeline, I think this would require “dynamic” stacks (per different PRs, etc.) does that make sense? I couldn’t find documentation on this subject
g
it should not be a problem to create a short-lived stack via CI - eg 1st job will deploy and then the last job destroy including
stack rm
We are planning to build a PR environment but most likely abstract it using Automation API.
w
feels like I’m reinventing the wheel, but I think this can’t be an out-of-the-box solution as it depends on a fully customized pulumi project to begin with
now that I know I can reference an existing kubeconfig from the “main” stack, I can use it to set up the new stack
question is, how do you dynamically create new stacks? copy a template stack yml?
g
That's relatively simple, you have 2 options: 1) CLI • Have pulumi project folder ready - which you probably have for workload env (dev/prod..) • then either
cd my_project
• and then
pulumi stack init my-stack -C <path to my_project>
- https://www.pulumi.com/docs/reference/cli/pulumi_stack_init/) 2) Similar process with Automation API: • https://www.pulumi.com/docs/guides/automation-api/https://github.com/pulumi/automation-api-examples/blob/main/python/inline_program/main.py#L59