I don't have a good grasp on providers; I use (typ...
# general
I don't have a good grasp on providers; I use (typescript)
to delete some CRDs when a specific helm chart is deleted. I'd like to be able to write:
Copy code
new local.Command("name", {
  delete: "kubectl delete thing"
}, { provider: k8sProvider});
However that yields:
unrecognized resource type: "command:local:Command" for this provider
The error message suggests that somehow makeKubeProvider can be made aware of other providers - but it's really opaque to me as to how this happens. I'm also pulling a blank searching for docs on how this works. Does anyone have any pointers?
Also, it occurred to me that perhaps providers aren't typically cross compatible this way? It would introduce a layer of dependency for example which may make updating pulumi-kubernetes harder. What sort of guidance exists in terms of understanding whether this sort of cross-package dependence is acceptable or not.
FWIW, this is my current strategy:
Copy code
pulumi.all([clusterCore.kubeconfig]).apply(([config]) => {
    // this leaves some trash around; gitignore manages this.
    // not clear if this is nasty; but without updating k8sProvider
    // to understand local.Command
    const filename = `kubeconfig.${hash(stack)}.json`;
    writeFileSync(filename, JSON.stringify(config));
      (crd) =>
        new local.Command(
            delete: `kubectl delete crd ${crd}`,
            environment: {
              KUBECONFIG: filename,
clusterCore is an
type from the
When you specify an explicit provider (which you usually do not need to do), it needs to be of the same type that that resource belongs to.
can only take an explicit CommandProvider, not a K8s provider.
If you want to deploy a K8s resource after creating a K8s cluster in the same program, you'll need to create an explicit K8s provider with the kubeconfig of the cluster you just provisioned.
👋🏼 @stocky-restaurant-98004 - thanks for your thoughts. Good to know that cross provider isn't a thing. The error message definitely led me astray a little there.
Feel free to submit an issue to https://github.com/pulumi/pulumi if you'd like that error message improved.
I mean.. I think it would just say "RTFM, don't imagine what the software could do" 😅 The message as interpreted by my brain made me think there was some ability to "magically" interpret provider abilities. The docs for command do a solid job of illustrating using the env to set the kubeconfig and in my case I just need to write a temp file to reference. RE: specifying explicit providers "which you usually do not need to do" I do it because it's possible, in a dev context, for my system config to be referencing a different cluster than what I have pulumi operating on. So I'm explicit about the k8s cluster to interact with.