prehistoric-kite-30979
03/01/2022, 3:40 PMconst opts = { ...options.Azure('azure'), region: stack.region, resourceGroupName }
options.Azure is located in a separate TS package and does the following:
export function Azure(
name: string,
opts?: CustomResourceOptions,
providerOptions?: ProviderOptions,
): AzureOptions {
const subscriptionId = cfg.require('subscriptionId')
const provider = new azure.Provider(
name,
{
tenantId,
subscriptionId,
clientId: cfg.require('clientId'),
clientSecret: cfg.requireSecret('clientSecret'),
},
providerOptions,
)
return {
subscriptionId,
provider,
...opts,
}
}
I suspect it has something to do with it being in a separate package… any ideas?little-cartoon-10569
03/01/2022, 7:59 PMcfg
come from? If you call any Pulumi static method (e.g. getStack()) without having started the engine, you will see this error. Maybe you can change the order of imports? Or change cfg
from being created inside the imported module to being passed into it from the main program?const cfg = new pulumi.Config();
in your module, that's definitely not going to work. Do that in you main program and pass it to the module.args
and opts
constructor parameters.prehistoric-kite-30979
03/01/2022, 8:44 PMCoupling your module to the shape of your program’s config file is not a good idea and will bite you in the futureWe use it to override the default provider behavior and these are just helpers to build out the correct providers.
little-cartoon-10569
03/01/2022, 9:06 PMprehistoric-kite-30979
03/01/2022, 9:16 PM