https://pulumi.com logo
#general
Title
# general
b

boundless-room-95091

11/12/2021, 7:31 PM
Hi, right now we have all our clients based on Terraform and we have a lot of custom modules for all AWS resources (and more) created in Terraform by ourselves, so we can reproduce similar architectures so simply using Terraform + Terragrunt. Now we a looking for a way to migrate the logic of some of our modules to pulumi,for this purpose i'm investigating how to create our custom Python Packages for Pulumi so we can have something more generic that can be reused in multiple clients, there is any recommended way to make somethin like this?.
s

stocky-restaurant-98004

11/12/2021, 8:19 PM
Plain old Python packages are one way to solve this problem. In addition, if your org is large and uses a multitude of languages, multi-language components might be a good fit for your problem: https://www.pulumi.com/blog/pulumiup-pulumi-packages-multi-language-components/
b

boundless-room-95091

11/15/2021, 3:13 PM
Yeah! i'm thinking in Python packages but i cant figure out a good practice to make it. Have you any example?
i want to use packages and still using the Pulumi.yaml to set the values. I dont know if the best way is using packages as clases like this (fast typed) example:
s

stocky-restaurant-98004

11/17/2021, 4:00 PM
You want to use Pulumi.yaml to pass values to your Python packages? Why not just use regular code?
b

boundless-room-95091

11/17/2021, 7:22 PM
Yes i want to pass values with Pulumi.yaml, what do you mean with regular code??
@stocky-restaurant-98004
s

stocky-restaurant-98004

11/17/2021, 8:38 PM
Well, if you want to pass a value to a Python module, you don't have to use Pulumi.yaml - you can use any way you like to grab the value.
b

boundless-room-95091

11/17/2021, 9:56 PM
Yes! i know that its a better practice, i'll work on it. Now i'm looking for use ComponentResource, is it a better aproach for this module oriented architecture?
s

stocky-restaurant-98004

11/19/2021, 2:06 PM
I'm not totally sure I understand what you're asking, but I would recommend creating a class that encapsulates some major component of the infra you want to modularize. The values should be passed to the module directly via code if possible. I wouldn't recommend, e.g., a module taking a config value directly from an external YAML file.
🙏 1