Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you get a resource's region in Pulumi

Tags:

pulumi

I have a Cognito user pool in Pulumi and I need to reference its region in another resource. How does one get the region for a resource in Pulumi?

like image 679
Michael Golfi Avatar asked Oct 18 '25 03:10

Michael Golfi


1 Answers

The AWS provider doesn't allow defining the region per each resource. Instead, region is a property of the provider itself.

If you use the default ambient provider, then the region is in aws.config.region:

const user = new aws.cognito.UserPool("up", { ... });

export const region = aws.config.region;

If you use an explicit provider, the region is defined by its options:

const myProvider = new aws.Provider("my-provider", {
    region: "eu-north-1",
});

const user = new aws.cognito.UserPool("up", { ... }, { provider: myProvider });
like image 74
Mikhail Shilkov Avatar answered Oct 22 '25 08:10

Mikhail Shilkov



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!