sort of like `{ providers: { aws: awsProvider, aws...
# general
g
sort of like
{ providers: { aws: awsProvider, awsNative: awsNativeProvider } }
or is this not supported?
d
This is supported. I'd recommend passing them in as a list instead of an object, however
g
right
why do you recommend the list approach?
d
So that you don't need to worry about provider names; pulumi will handle this for you internally
g
the reason I ask is that our hostedZone is in another account; we need to pass 2aws classic providers and an aws native provider. In that case within the component selecting the correct provider becomes harder, no?
and under that condition, presuming we pass
{ providers: { primaryAccount: primaryProvider, hostedZoneAccount: hostedZoneProvider, nativeProvider: nativeProvider } }
then in components I'd have to pass
{ parent: this, provider: opts.providers.primaryAccount }
{ parent: this, provider: opts.providers.nativeProvider }
and so on?
sorry i meant to write account
d
Ah, then yes using a map here would be best. What you've written looks correct
g
Thank you Anthony
I think I have a bug, in that case. I'll chase it up
it doesn't like something about what i'm doing, wasn't sure if there was a limitation on the types of things that can be passed
do you know if disabling default providers would have interactions here?
d
If you know you'll only be using explicit providers, you should disable the default providers. It helps catch places where selecting a provider falls through
g
I thought I had, in other projects i have done that and everything worked there. I think there ?may? be some funny business; when passing native & classic aws providers to my custom component it complains;
Copy code
error: missing required configuration key "aws-native:region":The region where AWS operations will take place. Examples are eu-east-1, eu-west-2, etc.
    	Set a value using the command `pulumi config set aws-native:region <value>`
I think it may be because i'm using special keys, not
aws
and
aws-native
but named providers, names more akin to
account1ClassicProvider
,
account2ClassicProvider
Each actual pulumi resource has it's precise provider specified but the component might be having a hard time trying to match things up, i don't know
strange business
i'll figure out as much as I can; if there's anything to it I should probably let the team know to add it to docs
thank you for being helpful
d
With special names, you'll need to pass the provider explicitly to every resource within the component. If you know most resources will be for a specific account/region, set that with the default name
g
I recon the custom component class itself is causing the pain
understood, though
d
g
yeah
i just did it
i thought it had already been done but i was wrong, we have many projects and they're all disabled but this on was initialized incorrectly - i've now done that so i'l lgo away & do more tests
aaaand some new code issues - i think my native provider might have been 'undefined' this whole time
LOVELY
i should have been a sparky
d
As in an electrician? Circuitry + embedded programming is picking up again. It's nice working on something physical sometimes 😂
g
i mean like a domestic electrician screwing in light bulbs & crimping red wire to more red wire
i just feel like they have far fewer conundrums
then again fishing for wires behind drywall isn't great
d
You sure? Because you worked all this out on your own while asking the right questions in the area you were unsure about. Simple mistakes happen sometimes 🤷
g
used to be a welder - was happier but less wealthy
not happier, actually, more content
never as frustrated
d
Some of it will go away with time as you learn more. Hope you're still doing welding as a hobby, though!