https://pulumi.com logo
Title
r

red-football-97286

04/23/2021, 3:08 PM
Has anyone done anything similar?
b

bored-oyster-3147

04/23/2021, 3:17 PM
My team uses a suite of component resources for our most common use-cases.. but what are you looking to do specifically?
r

red-football-97286

04/23/2021, 3:27 PM
Thanks for replying Joshua. So we have an existing pattern book for AWS for some of our business components. We are going to use pulumi, but want to build out these patterns which could be reused for other patterns...if that makes sense?
b

bored-oyster-3147

04/23/2021, 3:30 PM
Nice. Yea, that makes sense. We use the .NET SDK and we have an internal NuGet repository so we package component resources into NuGet packages to be shared internally. It works for us. We don't really use stack references because we use self-hosted state backend in S3 and tend to separate the state backend by project so the stack references don't work in that case.. but we haven't found that we really need them for our use-case.
It's worth mentioning that the newly announced "pulumi packages" would enable you to build distributable component resources across the different pulumi supported languages. So if one team wants to write their components in TS and the other in GO.. theoretically there is support for that or there will be
p

prehistoric-coat-10166

04/23/2021, 3:32 PM
I've found StackReferences to work well when you want to create separate projects/stacks with different lifecycles, so for example creating a Kubernetes cluster in a separate project which outputs the KubeConfig and then referencing the KubeConfig using StackReference in another stack for managing resources. ComponentResources allow you to create your own abstractions on top of the resources, so you can provide your interfaces for creating your resources.
💯 1
b

bored-oyster-3147

04/23/2021, 3:32 PM
r

red-football-97286

04/23/2021, 3:36 PM
Thank you Ville and Joshua. I'm keen to look at packages, looked a little confusing on how to build them on first look. Would you build your own components and then package then? I will be using TypeScript.
b

bored-oyster-3147

04/23/2021, 3:38 PM
If your team is just using 1 language internally than you probably won't really need to worry about it. Just thought it was worth mentioning. You can write common typescript component resources and internally distribute them however you would normally package typescript libraries
r

red-football-97286

04/23/2021, 3:38 PM
packages would work and be nice.
So would it be write a component resource then package?
b

bored-oyster-3147

04/23/2021, 3:41 PM
yea I'm not personally familiar with writing packages for the TS ecosystem but however you would normally distribute a private NPM package would work
r

red-football-97286

04/23/2021, 3:41 PM
Sorry, I meant building a pulumi package
b

bored-oyster-3147

04/23/2021, 3:43 PM
Oh If you want to make it a "Pulumi Package", meaning a consumer from any pulumi supported language could take a dependency on your component resource, than I believe that article points you in the right direction at the bottom. There is a couple different ways to do it
r

red-football-97286

04/23/2021, 3:43 PM
I'll take a look. Thank you for your help!
p

prehistoric-coat-10166

04/23/2021, 3:44 PM
Here is a TypeScript boilerplate repository for creating your own component package https://github.com/pulumi/pulumi-component-provider-ts-boilerplate
r

red-football-97286

04/23/2021, 3:44 PM
Awesome, thanks Ville!