Hey, I have this block to get the IP address of th...
# golang
s
Hey, I have this block to get the IP address of the loadbalancer:
Copy code
loadBalancerIP := chart.GetResource("extensions/v1beta1/Ingress", "server", "default").
	ApplyT(func(input interface{}) pulumi.StringOutput {
		ingress := input.(*v1beta1.Ingress)
		return ingress.Status.LoadBalancer().Ingress().Index(<http://pulumi.Int|pulumi.Int>(0)).Ip().Elem()
	})

ctx.Export("loadBalancerIP", loadBalancerIP)
The IP shows as expected from the
Export
but I want to use the IP in a DNS record:
Copy code
_, err = dns.NewRecordSet(ctx, "serverRecordSet", &dns.RecordSetArgs{
  Rrdatas: pulumi.StringArray{loadBalancerIP},
  [snip]
loadBalancerIP is of type
pulumi.Output
, not
pulumi.StringOutput
so it isnโ€™t accepted. Anybody have a hint on how I can handle the conversion?
โœ… 1
b
i think you might be able to do
loadBalancerIP.(pulumi.StringOutput)
s
thanks for the feedback, applying the type directly like this I get a panic
Copy code
interface conversion: pulumi.Output is pulumi.AnyOutput, not pulumi.StringOutput
when running
pulumi up
w
Looks like you are running into https://github.com/pulumi/pulumi/issues/6073. As noted in the latest comment there - you should be able to workaround that with this:
Copy code
// To workaround #6073, convert from `interface{}` to `string`
x1 := x.ApplyT(func(v interface{}) string {
    return v.(string)
}).(pulumi.StringOutput)
๐Ÿ™Œ 2
s
Thanks! That solved my issue!
g
Hah I was running into a similar issue, praise be!
๐Ÿ‘ 2