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

purple-train-14007

04/12/2021, 10:13 PM
Maybe someone can help me out here. I’m kinda stuck on trying to figure out how to do what I want to do. So I want to make a network class with subnets and then new an instance of that class with details from the pulumi config file. I want to do this so the logic is reusable and we don’t have write the same code twice. I thought I could potentially get away with this by using some access modifiers however that won’t work. Any hints in the right direction would help 😇
t

tall-librarian-49374

04/13/2021, 6:24 AM
Your plan sounds reasonable. I can’t grasp the problem that you are facing yet… Here is one example of a reusable component, if that helps https://github.com/pulumi/examples/blob/master/azure-cs-net5-aks-webapp/AksCluster.cs
p

purple-train-14007

04/13/2021, 2:20 PM
Thanks Mikhail, Ill take a look!
Also, just to share what I have so far. Here is what I currently have.
t

tall-librarian-49374

04/13/2021, 3:41 PM
Reading from config like this seems reasonable. If you want, you may have some helper class/methods with parameters for vnets/subnets/… and pass the configured values to it from the Stack class.
p

purple-train-14007

04/13/2021, 6:05 PM
Thanks! Got it working 🙂