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

brash-waitress-49970

08/25/2023, 1:04 PM
Hi all! I am in the midst of diving deep into converting our (unfortunately relatively complex) Terraform setup to Pulumi. Before I start tunneling I just want to quickly make sure I got the outline right. In Terraform, we used modules that represented regions to deploy resources to multiple regions simultaneously. Am I rightly assuming I would put the region information in my stack yaml file and loop over it in my Pulumi code? Or is there another (more native?) way to replicate this here? Thank you very much.
b

billowy-army-68599

08/25/2023, 1:46 PM
hi @brash-waitress-49970 - this is actually way easier in Pulumi. In terraform, providers are global. In Pulumi, providers are at the resource level. So you can use an explicit provider and do something like this: https://github.com/jaxxstorm/pulumi-examples/blob/main/python/aws/ec2_providers_loop/__main__.py#L5-L9
b

brash-waitress-49970

08/25/2023, 2:11 PM
thank you, that makes it more clear!
Just to make sure:
config:
aws:region: eu-central-1
doesnt have any impact unless I use it in my code?
s

salmon-account-74572

08/28/2023, 2:35 PM
The
aws:region
configuration will impact the default provider, but won’t affect any explicit providers you create using a technique like @billowy-army-68599 suggests. For deploying to multiple regions with a single stack, using explicit providers is the way to go. For deploying the same set of resources to different regions, use a different stack for each region (with an appropriate configuration value set). Let us know if you have more questions, we’re happy to help!
b

brash-waitress-49970

08/28/2023, 3:08 PM
Thank you very much Scott! I love the freedom Pulumi allows 😄 I am currently separating my former TF workspaces into projects, with stacks per env under them. Another question for that: I have information that I want to share across all projects (regions, AWS account Ids, etc..). Is there a Pulumi native way to do this or do I have to merge some yamls myself before I trigger Pulumi?
s

salmon-account-74572

08/28/2023, 3:10 PM
You could build some custom code that reads from a central configuration file, but I’m not aware of a “Pulumi native way” to do that for multiple projects. (There is project-level configuration for sharing stuff across stacks within a project.)
b

brash-waitress-49970

08/28/2023, 3:14 PM
Of the latter I am aware, thank you! 😄 But yeah, I will then gladly go and build some utils around my Pulumi repository. There will be common Go functions I'll want to share across projects anyway, so I will build my setup with that in mind
s

salmon-account-74572

08/28/2023, 3:33 PM
Fantastic. Let us know how we can continue to help.