https://pulumi.com logo
#general
Title
# general
b

brave-angle-33257

10/15/2019, 1:05 AM
trying to follow this example on the docs page, but it’s not working:
Copy code
import * as k8s from "@pulumi/kubernetes";
import * as pulumi from "@pulumi/pulumi";
const env = pulumi.getStack();
const infra = new pulumi.StackReference(`acmecorp/infra/${env}`);
const provider = new k8s.Provider("k8s", { kubeconfig: infra.getOutput("kubeConfig") });
const service = new k8s.core.v1.Service(..., { provider: provider });
when I do this, it says
Copy code
pulumi:providers:kubernetes (k8s):
    error: pulumi:providers:kubernetes resource 'k8s's property 'kubeconfig' value {map[apiVersion:{v1} .... {aws-iam-authenticator}]}]}]}]}]} has a problem: provider property values must be strings
i’ve tried using .apply(), JSON.stringify, <string> etc
if I copy and paste the contents of the kubeconfig file as a string instead of using the output, it works
h

handsome-actor-1155

10/15/2019, 1:07 AM
Try this:
Copy code
const kubeconfig = infraStack.getOutput("kubeConfig").apply(JSON.stringify);
b

brave-angle-33257

10/15/2019, 1:08 AM
i still have the hardest time in this particular nook of pulumi
awesome that does work thank you
h

handsome-actor-1155

10/15/2019, 1:12 AM
np