https://pulumi.com logo
#getting-started
Title
# getting-started
g

gorgeous-honey-75918

01/18/2024, 1:17 PM
In terraform modules is a thing. Simplyfying how much configuration needs for example for a VPC. Is this translated to pulumi. Or must I code each resource one by one?
g

great-zebra-31498

01/18/2024, 1:34 PM
In pulumi, using your favourite programming language, you can organise your code in units (e.g. packages/classes/functions) in a similar way as terraform modules
g

gorgeous-honey-75918

01/18/2024, 1:36 PM
Thanks But are there official registries for the common packages? Like this one for VPC. https://registry.terraform.io/modules/terraform-aws-modules/vpc/aws/latest Basically, I trust other people to maintain their "modules" better than me and mine 😉 How could I set this up for my own resources. Without inventing the VPC code wheel. My VPC logic for now is a lot of complicated code. Endpoints.. Nat gateways.. route tables etc..
g

great-zebra-31498

01/18/2024, 2:51 PM
For starters, I would recommend checking those 2 places https://www.pulumi.com/registry/ https://www.pulumi.com/docs/clouds/aws/guides/
b

better-kitchen-49894

01/18/2024, 2:52 PM
Specifically for AWS, Pulumi provides the Crosswalk package, which includes a VPC module: https://www.pulumi.com/docs/clouds/aws/guides/vpc/ Pulumi has a registry also, although not as extensive as for Terraform: https://www.pulumi.com/registry/
a

ambitious-stone-55649

01/18/2024, 3:03 PM
I have a post in which I create a vpc with pulumi : https://medium.com/@sergio.salmador/first-project-with-pulumi-e12ff72277bc
r

red-match-15116

01/18/2024, 4:46 PM
The pulumi equivalent of modules is components. If you filter by
component
type here: https://www.pulumi.com/registry/
g

gorgeous-honey-75918

01/18/2024, 5:17 PM
Thanks guys. There any way to import existing resources into components though? https://github.com/pulumi/pulumi/issues/9146 makes me think no
l

limited-rainbow-51650

01/22/2024, 3:25 PM
@gorgeous-honey-75918 while that issue is still open, work has been done to mitigate this. If you create an import file, you can point to a parent component where the resource needs to be imported into. To start, see the section on the import file here: https://www.pulumi.com/docs/cli/commands/pulumi_import/ If you want a file generated for your setup, which includes the pulumi side of things, you can use
pulumi preview --import-file
. Add all the actual resource ids to this file for the infrastructure you want to import. Remove entries from this file what already exists in the Pulumi stack.
Here is the epic tracking all the work around it: https://github.com/pulumi/pulumi/issues/14510 While the epic is still open, you can see all the individual items checked off.