https://pulumi.com logo
#general
Title
# general
l

lively-controller-39972

02/05/2023, 1:36 PM
Hi everyone. I have a "production" branch, a "staging" branch and then multiple feature branches. Should I create a stack per branch in my CI?
o

orange-policeman-59119

02/05/2023, 3:48 PM
Definitely. You will want a stack per branch so that the resources deployed in each are separate from one another.
l

lively-controller-39972

02/05/2023, 3:49 PM
So for each, I need to create Pulumi.[branch-name].yml with my config?
It doesn't seem very optimal because I am just going to copy paste the same config everytime
m

miniature-musician-31262

02/05/2023, 5:52 PM
You might want to check out project-level configuration, which can help reduce some of this kind of duplication: https://www.pulumi.com/blog/project-config-mvp/
l

lively-controller-39972

02/05/2023, 9:45 PM
Project level conf is conf that applies to all stacks, so that is not what is appropriate in the situation?
o

orange-policeman-59119

02/05/2023, 10:15 PM
It doesn't seem very optimal because I am just going to copy paste the same config everytime
Project level config will allow you to put the common configuration in Pulumi.yaml, and the unique config that is per-stack in each of the separate stack config files.
l

lively-controller-39972

02/05/2023, 11:46 PM
Yes, but what if I want to deploy my stack
feature-branch
for each of my feature branch? How could I do?
o

orange-policeman-59119

02/05/2023, 11:47 PM
Use the CLI or automation API to configure your per-branch stacks. Use project config for common configuration. If you have constants that are the same across all of your stacks, you can put those in code as well, if it makes more sense.
n

narrow-guitar-10891

02/06/2023, 8:04 AM
You can create one Pulumi.default.yaml (for example) and on feature branches run:
pulumi up --stack ${BRANCH_NAME_SLUG} --config-file Pulumi.default.yaml
l

lively-controller-39972

02/06/2023, 12:30 PM
Thanks @narrow-guitar-10891for your solution!! That seems to be the correct way of handling my problem!
n

narrow-guitar-10891

02/06/2023, 12:30 PM
🔥
4 Views