Hi all! I am in the midst of diving deep into con...
# getting-started
b
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
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
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
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
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
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
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
Fantastic. Let us know how we can continue to help.