This message was deleted.
# general
s
This message was deleted.
g
how about this from example?
Copy code
from pulumi import get_stack, ResourceOptions, StackReference
from pulumi_kubernetes import Provider, core

env = get_stack()
infra = StackReference(f"mycompany/infra/{env}")
provider = Provider("k8s", kubeconfig=infra.get_output("kubeConfig"))
service = core.v1.Service(..., ResourceOptions(provider=provider))
l
You cannot get the provider from one stack into another. You can create a new provider with all the same parameters, if you pass those parameters by Stack Reference.
StackRefererence.getProvider()
gets the provider used to create the stack, not one of the providers that was created within the stack. You cannot use
StackReference.getProvider()
to achieve anything useful (that provider is the default Pulumi provider, which afaik is null).
b
I see ! Shame, it would’ve been helpful to be able to get the default provider this way ;) Thanks for your help !
l
The default provider is always
null
.
Each default provider. So your default AWS provider is
null
, default TLS provider is
null
, etc.
And if you want to get a specific provider to be used by two stacks, then pass the same creds into both stacks and initialize both providers the same way. This is kind of a "gimme" in a single project with multiple stacks, and pretty easy in multiple projects.
🙏 1
👍 1