Stack per env seems to be a 'best practise' patter...
# getting-started
w
Stack per env seems to be a 'best practise' pattern, but curious how folks are dealing with environments that diverge in more than just simple parameters. For instance in dev I might want a private hosted zone, and a direct connect or whatever, but in prod it's public and something something etc... Are folks just doing env-branching in the code?
if env == dev: do x elif env == prod do y
?
b
I do some of that
s
That's one of the methods we use.
p
Same here. Considering that pulumi uses fully-fledged programming language and not some custom DSL (looking at you, terraform), there are many ways to keep it nice and clean. That is, you don’t have to scatter the conditionals everywhere in the code. If you want to go full OOP, you can even write a factory class that’s gonna generate the correct implementation based on some
env
argument.
c
For us anything that is different is parametrised and placed in the configuration settings, so there is very little logic for env-branching. There is however, a lot of conditional logic in our code to cover the configuration mutations.
w
Thanks all 🙂