tldr: how can I tell Pulumi which provider should ...
# kubernetes
c
tldr: how can I tell Pulumi which provider should be used to delete a resource? Here is what my code does: 1. Create a GKE cluster 2. Generate a kubeconfig 3. Create a Kubernetes provider using that kubeconfig 4. Deploy stuff on the GKE cluster using that dynamically provisioned provider This works well! However, when a remove from my code something that was deployed using that provider, Pulumi tries to delete that resource using a default provider, that tries to read ~/.kube/config, so it fails. I am looking for a way to make Pulumi use the dynamically provisioned Kubernetes provider.
a
Pulumi should use the same provider during a delete as it did during a create. You don’t need to tell it to. If its using the default provider to delete a resource created with a explicit provider, thats a bug. Would you be willing to file an issue at https://github.com/pulumi/pulumi/issues/new/choose?
c
I'll write a simplified version of my code to reproduce it first. If I am able to reproduce it I'll open an issue. Thanks Ian!
a
It sounds like the behavior you are describing is correct. Confusion between
provider
and
providers
is a known issue.
provider/providers
is an API that is incredibly easy to confuse. I thought we had a warning for that in the Python SDK. Since it doesn’t sound like you saw any such warning, an issue describing your experience would be appreciated. We’re in an unfortunate place with backwards compatibility on the underlying API, but it is something we plan to address for Pulumi 4.0. Your feedback is appreciated.
c
I've seen no such warning. What's the difference between provider and providers?
a
provider
tells Pulumi what provider to use with the resource. For a GKE cluster, the only valid
provider
would be Provider for google.
providers
tells Pulumi what providers to use for child resources, and is intended to be passed to component resources.
c
Oh, that explains my issue, thanks! 🙂
I did my best to express my frustrations, attempts, and ideas: https://github.com/pulumi/pulumi/issues/11732 But I'm not sure it's very actionable yet.