https://pulumi.com logo
Title
c

colossal-ice-49128

08/20/2021, 9:49 PM
I need to deploy basically the same stack to the US and EU-- two different AWS regions. The correct way to do this is to have a multiple stack config files like
Pulumi.us-Production
and
Pulumi.eu-Production
right? The other way is to do it in code but I don’t think that fits nicely with the existing configuration model.
b

bored-oyster-3147

08/20/2021, 10:03 PM
You could encapsulate your entire stack into a
ComponentResource
and then instead declare 1 of those for each region at the top of your stack. This would allow you to have a single
Production
stack. Or just do separate stack configs
Hell you could encapsulate you entire stack into a
ComponentResource
as I mentioned, and then you could have your config contain a list of regions to deploy into. Then your
Stack
code could loop on those and declare an instance of your
ComponentResource
for each of them. That way your
Staging
stack which might only need 1 region could just be a config change
c

colossal-ice-49128

08/20/2021, 10:12 PM
I’m thinking separate stack configs is the way to go
g

great-sunset-355

08/22/2021, 7:43 AM
This is a tricky question because it's highly dependent on an environment and your requirements for the "agility" of your resources. If your solution is using just 2 regions and will do for a long time. Then Stack per region is good. You can also make use of namespaces in config and have 1 stack for both regions like Joshua suggested.
Pulumi.production.yaml
us-region:config_key:  value

eu-region:config_key: value
then in code:
us_config = pulumi.Config('us-region')
eu-config = pulumi.Config('eu-region')
b

bored-oyster-3147

08/22/2021, 6:41 PM
Yea I personally wouldn’t want multiple stacks per region. I’m just imagining stacks going out of sync because now you need to deploy multiple times per environment per release