https://pulumi.com logo
#general
Title
# general
p

purple-train-14007

04/19/2021, 4:28 PM
I decided to surf github and I noticed there are a lot of people writing their code in what I would consider in the typical way we program. I have also noticed that people are writing their Pulumi programs in a more declarative way not really instantiating anything (because pulumi does this for us?) . Which way is the right way? Or is it dealers choice? Any recommendations? I've been making classes and newing up instances of said classes instead of making consts and assigning attributes to them alone.
r

red-match-15116

04/19/2021, 4:39 PM
Wanna show us what you mean with some code?
p

purple-train-14007

04/19/2021, 5:01 PM
Sure, so there is this way by making an interface and helper class.
And then there is this way Ive seen where you just do a bunch of consts basically.
r

red-match-15116

04/19/2021, 5:08 PM
Ah yeah it’s up to you really. If you are logically grouping resources together in your classes, you might consider using component resources: https://www.pulumi.com/docs/intro/concepts/resources/#authoring-a-new-component-resource Your current structure makes sense for reuse of the components you create, whereas the const-based flow might make sense for one-off deployments.
p

purple-train-14007

04/19/2021, 5:23 PM
Oh gotcha gotcha. Makes sesne
Thanks for the link. This is good to know about
partypus 8bit 1