This message was deleted.
# getting-started
s
This message was deleted.
b
can you elaborate on what you mean by passing it around? you’ll need to reference the provider somehow
are you referring to the terraform behaviour of interpolating all files in a directory? Pulumi doesn’t do that
b
@billowy-army-68599 Thanks for the prompt reply. So my default region for aws is
eu-west-2
and I needed to create some resources a few months ago in
us-west-2
. So I created a new provider and set the region. Now I need to add some more resources to
us-west-2
. How do I get this provider from the current stack?
I can't just use the local variable because it's in a different file
previously I did
Copy code
let provider = new aws.Provider(`default-us-west-2`, {
    region: 'us-west-2'
});
So need to get
default-us-west-2
from the stack!?
b
ah, then export the variable
export const provider = new aws.provider
add an import into the place you want to use it
Copy code
import * from as westprovider from "./providerfile"
And then you can reference it as
Copy code
westprovider.provider
👍 1
b
is that the only way? I would have thought you could get resources from the stack. Like you can with
aws.secretsmanager.getSecret()
b
that calls the API of AWS, you can’t
get
a provider
having said that, there’s absolute no downside to just creating another provider, you can create as many as you like
b
Yeah it will soon get messy though, I think I'll create a Providers class which keeps static references. This will be tidier than creating lots of providers the same with different names. Thank-you for your time