I'm trying to get the cluster name for a Provider ...
# kubernetes
p
I'm trying to get the cluster name for a Provider I'm using to provision resources with. I could export it from the other stack which makes the kluster from where I export the kubeconfig from which I made the Provider, but I feel I should be able to get it from the Provider and thus need 1 fewer export/import. https://www.pulumi.com/registry/packages/kubernetes/api-docs/provider/#cluster_nodejs clearly shows a cluster property as one of the inputs for the Provider function and further down the page it says: "All input properties are implicitly available as output properties." But when I do:
Copy code
const monProvider = new k8s.Provider("monprov", {
        kubeconfig: kubeConfig,
});
pulumi.log.warn(`${monProvider.cluster}`);
I get
index.ts(184,32): error TS2339: Property 'cluster' does not exist on type 'Provider'.
what am I doing wrong?
b
inputs are indeed also outputs, but you’re not providing the cluster input property so it’s not available The provider is just a mechanism to know where the API is, you can’t derive the name from the provider unless you tell it what it is
you’ll need another export unfortunately
p
ah ok, so it would only have that input to output if I'd provided it in the k8s.Provider call, gotcha, thanks 😄