https://pulumi.com logo
Title
b

better-shampoo-48884

05/20/2021, 7:11 AM
quik question - if I pass a
provider
to a ComponentResource, will the underlying resources implicitly use that provider? I.e. I have a ComponentResource "network" - that creates azure-vnet, azure-subnet(s) and azure-networksecuritygroups - if I pass the provider to the "network" componentresource, will the vnet, subnets, and nsg's be created with that provider?
b

brave-planet-10645

05/20/2021, 8:02 AM
Are you talking about passing it in as an argument or as part of the ComponentResourcOptions parameter?
I've used it as an argument before and explicitly passed it in to the child resources before and that worked
b

better-shampoo-48884

05/20/2021, 9:48 AM
As part of the options was my plan
would simplify things a lot 😉
basically:
const provider = new Provider(`Provider`, groupConfig[0])
    /**
     * Creting the group that will contain all the subsequent resources
     */
    const group = new Group(`Group`, {
        groupInfo: groupConfig,
        create: shouldCreate.group
    },{
        parent: provider,
        provider: provider        
    })

    /**
     * Network is typically a given for any deployment
     */
    const net = new Network(`Net`, {
        group: group.location,
        groupInfo: groupConfig,
        network: config.getObject("network"),
        subnet: config.getObject("subnets"),
        create: shouldCreate.network
    }, {
        parent: group,
        provider: provider
    });
b

bored-oyster-3147

05/20/2021, 10:49 AM
I believe resources can inherit the provider from their parents. So since you should be setting the parent to the component resource for every member, it should get the provider
w

witty-candle-66007

05/20/2021, 11:07 AM