This might be a stupid question, coming from terra...
# typescript
This might be a stupid question, coming from terraform where you could create a module to bundle a few resources together. What would the equivalent be in pulumi?
there's a couple of options: 1. create a simple TS file that exports a reuse function with some parameters and in the body of that function create resources. Then simply import this function in wherever you need it. This only works well as long as the reuse function and the usage of that function are in the same repo. 2. create a simple TS file that creates a pulumi componentresource which encapsulates a bunch of other resources (creates them in a constructor) 3. do 1 or 2 and put the whole thing into an npm package that you publish into a private npm repo. I usually go for approach 1 and later opt for approach 3 if i need to reuse that function across multiple repositories. I skip 2 usually.
generally speaking, pulumi doesn't have / need it's own "module" system like terraform. You just use whatever module system / reuse mechanisms the host language provides, i.e. JavaScript / NPM modules (which are usually anyways better than terraform modules imho). I just ran the other day into the a limitation with terraform that you cannot include a module conditionally (doesn't support count) - with normal programming languages cases like that are a simple if statement 🙂
The conditional on module is the main reason looking at pulumi. Thanks for the options
Hi @numerous-plastic-88847, we have some docs on how to use
as @glamorous-printer-66548 pointed out above as one of the options. It's definitely worth a read.