https://pulumi.com logo
w

witty-vegetable-61961

04/23/2020, 4:58 PM
Hi Guys, I have a question: I am looking to use Pulumi for AWS in C#. I will need to provision EKS, S3, Lambda functions, Dynamo db, etc. I understand that stacks are per environment (Dev, test, prod etc), but surely each stack won't be the same code repeated? The code should be defined once (i.e. the provisioning of the resources). Does Pulumi have an equivalent concept to Terraform modules? So a module may exist for a VPC and with its inputs that you just call from a project, rather than writing the code itself.
g

gorgeous-egg-16927

04/23/2020, 5:42 PM
Yes, since Pulumi uses full programming languages, you can take advantage of the native abstraction capabilities of the language. Functions and classes are the most common solution, and you can bundle these up in your language’s package manager for other people to use.
w

witty-vegetable-61961

04/23/2020, 6:00 PM
So really the best workflow is to write a class library that would provision the resources I want/need, push this to a Nuget server, and then each of my stacks calls these? The key is, if there needs to be a change to the environment, this change is done in the consumed class library (e.g. provision another ec2 machine, etc), otherwise the change needs to be implemented per environment.
g

gorgeous-egg-16927

04/23/2020, 6:12 PM
That’s right. You can parameterize the classes however makes sense, and then set the config per environment. There’s a lot of flexibility, but typical software architecture practices apply.
w

witty-vegetable-61961

04/23/2020, 6:29 PM
Yup. So in my Terraform analogy, the module would be the class library I write that's consumed by the stacks.
👍 1