In terraform modules is a thing. Simplyfying how m...
# getting-started
g
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
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
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
For starters, I would recommend checking those 2 places https://www.pulumi.com/registry/ https://www.pulumi.com/docs/clouds/aws/guides/
b
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
I have a post in which I create a vpc with pulumi : https://medium.com/@sergio.salmador/first-project-with-pulumi-e12ff72277bc
r
The pulumi equivalent of modules is components. If you filter by
component
type here: https://www.pulumi.com/registry/
g
Thanks guys. There any way to import existing resources into components though? https://github.com/pulumi/pulumi/issues/9146 makes me think no
l
@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.