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

purple-train-14007

03/30/2021, 5:11 PM
is there a way to have a pulumi project deploy to multiple regions? I dont want to just deploy to WestUS-2. (Azure)
g

green-musician-49057

03/30/2021, 5:18 PM
You can instantiate additional Resource Providers to hit different regions: https://www.pulumi.com/docs/intro/concepts/resources/#providers
p

purple-train-14007

03/30/2021, 5:24 PM
Thankyou @green-musician-49057 I'll take a look at this.
@green-musician-49057 I want to thank you for the direct answer you provided to my question. This example is fantastic and is exactly what I needed.
thanks
This makes me think you cant create a custom provider for Azure. Is my assumption correct? I cant deploy to multiple regions for azure within the same stack? https://www.pulumi.com/docs/reference/pkg/azure/provider/#inputs
Or am I looking at the wrong API?
l

little-cartoon-10569

03/30/2021, 10:07 PM
You can. You need to use separate providers per region. One stack can use any number of providers.
You can deploy to AWS, k8s and Azure in the same stack, if you like.
p

purple-train-14007

03/30/2021, 10:08 PM
hmm..the API reference isnt showing anything for instantiating this
Closest thing I see is Environment. My assumptions are being made based on this example and the C# api reference for azures Provider. https://www.pulumi.com/docs/intro/concepts/resources/#explicit-provider-configuration
l

little-cartoon-10569

03/30/2021, 10:10 PM
Yes, that's the correct link
You can create as many providers as you like. In the example code, just one is created (useast1), but you can create any number.
p

purple-train-14007

03/30/2021, 10:11 PM
Right but look at the provider args. Those are supported args in Azures provider. Or am I overthinking this? https://www.pulumi.com/docs/reference/pkg/azure/provider/
l

little-cartoon-10569

03/30/2021, 10:11 PM
They can all be from the same package (e.g. Azure) or from multiple packages. They can all have the same parameters (e.g.
Region = "us-east-1
) or they call all be different.
p

purple-train-14007

03/30/2021, 10:13 PM
ok, I believe you. still new to this tool 😅
so it should look something like this then
l

little-cartoon-10569

03/30/2021, 10:13 PM
🙂
p

purple-train-14007

03/30/2021, 10:13 PM
l

little-cartoon-10569

03/30/2021, 10:13 PM
I don't know why those docs don't mention Region
p

purple-train-14007

03/30/2021, 10:14 PM
Yeah its making me think it doesnt exist and the compiler isnt liking it
it doesnt even show up as a selectable object when I push ctrl + space
l

little-cartoon-10569

03/30/2021, 10:14 PM
It's not in Azure Native either. Weeeird... let's look at some example code...
p

purple-train-14007

03/30/2021, 10:15 PM
yeah...thats what Im saying. I dont think this is a thing
it is in aws though 😅
l

little-cartoon-10569

03/30/2021, 10:16 PM
Yep... it should be there, I'd have thought...
p

purple-train-14007

03/30/2021, 10:16 PM
yeah its not. I just peeled back Pulumis covers. There is no region mention in any of the APIs.
its in everything but Azure.
l

little-cartoon-10569

03/30/2021, 10:17 PM
Apparently you can set azure:location in config.. let's see what that maps to...
p

purple-train-14007

03/30/2021, 10:18 PM
yeah but that conflicts wouldnt it? you cant have two values for the same object like that
for example. Default region for me.
Copy code
config:
  azure-native:location: westus-2
l

little-cartoon-10569

03/30/2021, 10:19 PM
Yes, that's what it's looking like at the moment. But maybe automation-api can work around this...
p

purple-train-14007

03/30/2021, 10:20 PM
hmm ok
yeah that violates Yaml syntax and cuases a duplication of keys
l

little-cartoon-10569

03/30/2021, 10:21 PM
Just found this error message in the provider source code:
reason += ". Either set it explicitly or configure it with 'pulumi config set azure-native:location <value>'."
Just need to figure out how to "set it explicitly"...
p

purple-train-14007

03/30/2021, 10:22 PM
hmm ok.
l

little-cartoon-10569

03/30/2021, 10:25 PM
Apparently it is possible: see this at bottom of https://www.pulumi.com/docs/get-started/azure/review-project/:
Note: In this program, the location of the resource group is set in the configuration setting azure-native:location (check the Pulumi.dev.yaml file). This is an easy way to set a global location for your program so you don’t have to specify the location for each resource manually. The location for the storage account is automatically derived from the location of the resource group. To override the location for a resource, simply set the location property to one of Azure’s supported locations.
Have to find the "location" property :)
p

purple-train-14007

03/30/2021, 10:26 PM
lol this is quite an easter egg hunt
just in time for the holiday
l

little-cartoon-10569

03/30/2021, 10:26 PM
🍳
Oooo... it's in the args, not the opts.
Ooop.
p

purple-train-14007

03/30/2021, 10:27 PM
huh?
l

little-cartoon-10569

03/30/2021, 10:27 PM
Looks like every Azure and Azure Native resource has a Location property.
p

purple-train-14007

03/30/2021, 10:28 PM
checking...
l

little-cartoon-10569

03/30/2021, 10:28 PM
So you don't use different providers. One provider can access any location.
p

purple-train-14007

03/30/2021, 10:28 PM
Thats...weird
l

little-cartoon-10569

03/30/2021, 10:28 PM
Certainly different!
Handy though, I guess.
Soo... this egg is cracked.
p

purple-train-14007

03/30/2021, 10:29 PM
omg Im blind!!!!
l

little-cartoon-10569

03/30/2021, 10:29 PM
👓
p

purple-train-14007

03/30/2021, 10:29 PM
It was there the whole time in Vnet 😱
l

little-cartoon-10569

03/30/2021, 10:29 PM
Kinda sticks out when you know to look for it, eh?
p

purple-train-14007

03/30/2021, 10:30 PM
Yeah, but I was going off the docs for general pulumi usage
oof
Looks like we can submit an edit to this page here. I think Ill do that.
Something like. If youre in Azure you dont have to do this
👍 1
Submitted an issue. If you feel its worth while help by upvoting it 😊 https://github.com/pulumi/docs/issues/5604
👍 1
2 Views