https://pulumi.com logo
c

cold-coat-35200

11/27/2018, 12:56 PM
hi, is it possible to get the default provider in the root index.ts file? I want to create a vpc peering connection between 2 different region and I don't want to recreate the default provider if not necessary, in terraform it's possible with
Copy code
providers = {
    aws.eu_central_1 = "aws"
    aws.eu_west_1    = "aws.eu-west-1"
  }
where "aws" means the default aws provider
w

white-balloon-205

11/27/2018, 1:36 PM
It appears we do not expose any direct way to get a handle to the default provider from within a Pulumi program - we definitely should - as
aws.Provider.default
or
aws.defaultProvider
. In the meantime, it looks like this is a way you can get to it if you really need it (a little roundabout):
Copy code
import * as aws from "@pulumi/aws";
import * as pulumi from "@pulumi/pulumi";

class Foo extends pulumi.ComponentResource {
    provider?: pulumi.ProviderResource;
    constructor(name: string) {
        super("default:provider", name);
        this.provider = this.getProvider("aws");
    }
}

let foo = new Foo("foo");
export let callerIdentity = aws.getCallerIdentity({ provider: foo.provider });
c

cold-coat-35200

11/27/2018, 1:49 PM
thanks, but in this case I create a new one, easier to understand
👍 1