https://pulumi.com logo
#dotnet
Title
a

abundant-knife-92318

09/15/2023, 11:17 AM
Hey! I'm new to Pulumi and I'm getting a little lost working out the best way to structure my program. I have a bunch of resources across Azure, CloudFlare, and Mongo Atlas. Is there any guidance or best practice I can read around how to structure a program? I have been creating classes that initialise resources in the constructor, but this seems to lead to some odd behaviour, and interesting gotchas. I feel like I'm doing something wrong, but all the examples I can find don't go into much detail and just lump everything into
program.cs
b

billowy-army-68599

09/15/2023, 2:13 PM
i wrote this a few weeks ago, let me know if it helps? https://leebriggs.co.uk/blog/2023/08/17/structuring-iac
a

abundant-knife-92318

09/15/2023, 2:33 PM
That seems to be angling towards making groups of related components into a
ComponentResource
?
b

billowy-army-68599

09/15/2023, 2:36 PM
correct, yes!
a

abundant-knife-92318

09/15/2023, 3:15 PM
Is there a situation where you would advice against doing that, or is it always pretty much the way to go
b

billowy-army-68599

09/15/2023, 3:32 PM
If you’re only managing a few resource in a stack, it’s not necessary. Once you get outside that components is always a better option
a

abundant-knife-92318

09/18/2023, 11:01 AM
Thanks, I'll take a look