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

incalculable-diamond-5088

04/13/2019, 4:01 PM
Hi, I’m trying to build a bootstrap program that will provision multiple organization accounts, each with its own VPC and EKS. The problem however is that https://github.com/pulumi/pulumi-awsx/blob/master/nodejs/awsx/ec2/vpc.ts#L25 does not support custom providers. For example, https://github.com/pulumi/pulumi-awsx/blob/master/nodejs/awsx/ec2/vpc.ts#L68 creates a VPC, not forwarding the provided custom providers. On the other hand, there’s https://github.com/pulumi/pulumi-awsx/blob/master/nodejs/awsx/ec2/vpcTopology.ts#L28 which does forward the provided opts to the created resource (https://github.com/pulumi/pulumi-awsx/blob/master/nodejs/awsx/ec2/vpcTopology.ts#L121), but it seems there’s a problem. ComponentResourceOptions defines a map of providers:
Copy code
export interface ComponentResourceOptions extends ResourceOptions {
    providers?: Record<string, ProviderResource>;
}
However, the Subnet is a
Resource
, not a
Component
and thus expects:
Copy code
export interface CustomResourceOptions extends ResourceOptions {
    provider?: ProviderResource;
}
Which has only a single provider. I created a PR https://github.com/pulumi/pulumi-awsx/pull/176, but I see it doesn’t advance. Please suggest how to achieve custom providers support across all pulumi modules
w

white-balloon-205

04/13/2019, 4:07 PM
If a provider is not specified, the corresponding provider on the parent component is used. If there is not one, it continues looking up the parent hierarchy. At the root Stack resource, the default provider is used. So you do not have to explicitly pass the provider along to children of a component - just the act of parenting them to the component will ensure they pick up the provider from the parent component. Do you have a small repro of exactly what you are trying to do? There may well be a bug in the awsx package here - but I suspect it is not just about passing provider on to children.
i

incalculable-diamond-5088

04/13/2019, 4:14 PM
hmmm… Interesting. So in this line: https://github.com/pulumi/pulumi-awsx/blob/master/nodejs/awsx/ec2/vpc.ts#L68 Will it use the provider of the component?
Or in other words, assume, I have:
Copy code
const provider1 = ...
const provider2 = ...
I want to create 2 awsx.ec2.Vpcs - one for each provider. How should I crate them?
w

white-balloon-205

04/13/2019, 4:17 PM
Ahh - that line appears to not be setting the parent either - which would be a bug and would cause the issue you are describing here. Could you open an issue to track this? Cc @lemon-spoon-91807.
i

incalculable-diamond-5088

04/13/2019, 4:30 PM
@white-balloon-205 how the line should look like? Maybe I’ll crate a PR for this. Also can you check the subnets creation here: https://github.com/pulumi/pulumi-awsx/blob/master/nodejs/awsx/ec2/vpcTopology.ts#L121?
l

lemon-spoon-91807

04/13/2019, 5:29 PM
Yup. Will file issue and will try to fix today
i

incalculable-diamond-5088

04/13/2019, 5:29 PM
@luk
@white-balloon-205 @lemon-spoon-91807 I updated https://github.com/pulumi/pulumi-awsx/pull/176 with the changes. Ran it now and it works.
l

lemon-spoon-91807

04/13/2019, 5:32 PM
I'll take a look later today. Thanks!