https://pulumi.com logo
Title
b

blue-tailor-71836

06/10/2022, 3:50 AM
Hi, we are extracting the provider information using the stackReference, but when i disabled the default provider, StackReference also required the provider information to pass on. What is the reason to pass the provider itself in stackReference and what would be the way to pass the provider information into StackReference itself?
// create provider
const gkeStack = new pulumi.StackReference(`{stack-name}/${pulumi.getStack()}`);
const provider = new k8s.Provider("k8s", { kubeconfig: gkeStack.getOutput("kubeconfig"), namespace: "{namespace}" });
Default provider for 'pulumi:pulumi:StackReference' disabled. 'pulumi:pulumi:StackReference' must use an explicit provider
l

little-cartoon-10569

06/10/2022, 4:38 AM
Have you disabled all default providers? Or just the k8s one?
If you disable all default providers, that's probably disabling the default Pulumi provider too. Instead of disabling *, you could disable k8s, aws etc. and this problem should go away.
b

blue-tailor-71836

06/10/2022, 4:39 AM
yes i disabled the all default providers and only wanted to use the explicit one.
let me try to disable the specific ones
l

little-cartoon-10569

06/10/2022, 4:41 AM
I'm looking to find the Pulumi provider class.. I don't even know what it's called. But a stack reference "class" is a resource, (you can see it on the resource graph) so it much be created by a provider...
Nope, can't figure it out. I'm confident there's a way to explicitly create an instance of the provider that created StackReferences... but I don't know how 😞
b

blue-tailor-71836

06/10/2022, 4:50 AM
No Worry! I have tried to disabled the specific ones and then getting the
registered twice error
resource 'urn:pulumi:qa::filescan::pulumi:pulumi:StackReference::qa' registered twice (read and read)
l

little-cartoon-10569

06/10/2022, 4:55 AM
Are you constructing the stack reference twice? Maybe in a loop, and not changing some important parameter?
b

blue-tailor-71836

06/10/2022, 5:17 AM
I am not constructing the StackReference Looks like it is reading twice
l

little-cartoon-10569

06/10/2022, 5:28 AM
You're not constructing it? 😕
b

blue-tailor-71836

06/10/2022, 6:28 AM
The issue was we were constructing a provider at different place which cause the conflicting and does allow to resource the provision
Well! Issue is resolved now
Thanks!