If i have a single tenant application with multipl...
# getting-started
b
If i have a single tenant application with multiple environments and customers whats the best way to handle this in pulumi. I think there's 2 approaches 1. A new stack for each customer and environment ie. pulumi stack init CustomerA.Test 2. A stack for Dev/Test/Prod and inside the yaml file a list of customers that can just be looped over in code. Any opinions on which approach is best or if theres another one im missing? There is no requirement for different customers to have different config/infra components
s
I'd recommend a separate stack for each combination of customer + environment:
Copy code
CustomerA-dev
CustomerA-test
CustomerA-prod
CustomerB-test
CustomerB-prod
CustomerC-prod
This ensures that each combination of customer + environment has its own independent state and cannot affect other combinations. To help with operations, use Automation API to manage the stacks.
l
Yes, I think looping over customers in code isn't likely to be a good idea. Remember that everything in a stack gets deployed/updated at the same time; you're very unlikely to want to update all your customers at the same time. Therefore, stack-per-customer is the way to go.
b
Great, thanks both. Our overall goal is to allow a developer to create these stacks without any input from us, we basically want to prompt them for a customername and nothing else. Would the automation API be the thing to look at for that kind of thing? Also interested in how we can do the same with our argo repo using outputs from pulumi. Ie we create a database and need to get the connection string into a new values file for that customer in our argo repo. Automation API or some glue code in a pipeline? Sorry if thats too big a question and thanks again!
l
automation-api would be great if you wanted to put a UI / CLI over it. If you expect to work on the Pulumi code directly, then you don't really need it (though it opens up nice options if you do use it).
Glue code is fine.
pulumi --stack x output | grep outputname
or similar should work.
s
Basically +1 to everything @little-cartoon-10569 said :-)
b
Great. Thank you both!
s
Happy to help!