https://pulumi.com logo
#golang
Title
# golang
m

millions-judge-24978

05/25/2020, 12:48 AM
I’m completely lost why I get an error from this snippet
Copy code
_, err = kubernetes.NewProvider(ctx, name, &kubernetes.ProviderArgs{
		Kubeconfig: doks.KubeConfigs.ApplyStringPtr(func(configs []digitalocean.KubernetesClusterKubeConfig) pulumi.StringPtrOutput {
			return pulumi.StringPtr(*configs[0].RawConfig).ToStringPtrOutput()
		}),
	}, parent)
panic: interface conversion: pulumi.Output is pulumi.AnyOutput, not pulumi.StringPtrOutput
I think what I want is
Copy code
_, err = kubernetes.NewProvider(ctx, name, &kubernetes.ProviderArgs{
		Kubeconfig: doks.KubeConfigs.ApplyStringPtr(func(configs []digitalocean.KubernetesClusterKubeConfig) *string {
			return configs[0].RawConfig
		}),
	}, parent)
although I don’t totally understand why
b

brainy-psychiatrist-41826

05/25/2020, 6:00 PM
i don't think that's what you want to do. i'm pretty sure pulumi-go goes out of it's way not to use primitive go types (e.g.
*string
).
to me it seems like the error is that
doks.KubeConfigs.ApplyStringPtr
was invoked with a
pulumi.AnyOutput
instead of a
pulumi.StringPtrOutput
?
3 Views