I am looking at how I structure our infrastructure...
# general
I am looking at how I structure our infrastructure within Pulumi. Is it right to have a single project with multiple stacks eg one stack to set up resource groups, another for networks, then for databases of various ilk and so on? The laternative is to have them in multiple projects, one for resource groups, one for networks, databases, key vaults and so on?
You can structure it as you want but I think the common approach is to use different projects for different things like network, database etc. Stacks are used to distinguish different instances of the project (e.g. dev, staging, prod).
That was my feeling then I was concerned with how things interacted, so as long as I understand my dependencies to know the build order it should all be good
Yes, this one. If you use different stacks to do different things, you need extra code with a load of "if (stack == "network) { ... }" code, and it gets awkward.
That’s more in line how pulumi works because “the same code” (I used quotes cause you can do some conditional logic based on the stack values etc.) is used while managing different stacks of the given project.
@little-cartoon-10569 explained it right - it’s double but it’s gonna look weird 😉
plus it seems to be less reusable
keep in mind that if you create different projects, you’ll probably wanna use stack references so you can depend on some resources created in the “parent” project
thanks heaps, I shall continue the journey and happy to know I had gotten it right so far. I'll look into the stack references
+ a very simple example illustrating the concept: https://github.com/pulumi/examples/tree/master/aws-py-stackreference
👍 1