How do I convert eks cluster,Kubeconfig from AnyOu...
# golang
How do I convert eks cluster,Kubeconfig from AnyOutput to StringOutput in the following: k8sProvider, err := providers.NewProvider( ctx, "k8sprovider", &providers.ProviderArgs{ Kubeconfig: cluster.Kubeconfig, }, pulumi.DependsOn([]pulumi.Resource{cluster})) if err != nil { fmt.Println(err.Error()) return err } Here ProviderArgs expect StringOutput, cluster.Kubeconfig is an AnyOutput.
you should be able to cast it with
I tried and get this error: invalid operation: cluster.Kubeconfig (variable of type pulumi.AnyOutput) is not an interface
Looks like this might be similar to this issue:
Here is my workaround:
cluster.Kubeconfig.ApplyT(func(v interface{}) string {
jsonBytes, _ := json.Marshal(v)
return string(jsonBytes)