Hi, we are extracting the provider information usi...
# general
b
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?
Copy code
// 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
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
yes i disabled the all default providers and only wanted to use the explicit one.
let me try to disable the specific ones
l
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
No Worry! I have tried to disabled the specific ones and then getting the
registered twice error
Copy code
resource 'urn:pulumi:qa::filescan::pulumi:pulumi:StackReference::qa' registered twice (read and read)
l
Are you constructing the stack reference twice? Maybe in a loop, and not changing some important parameter?
b
I am not constructing the StackReference Looks like it is reading twice
l
You're not constructing it? 😕
b
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!