Hi all, I have used pulumi a fair amount in JS. Bu...
# general
s
Hi all, I have used pulumi a fair amount in JS. But I have recently started using it in golang. In the golang implementation how do I use outputs, e.g the IP address of a network interface as an input for another object? So far I have been running an Apply on the output, then exporting using
ctx.Export
and finally to use it doing
ctx.GetConfig
. This just seems like jumping through hoops though so surely there is a better way I don't know about? Cheers
f
Out of interest, why did you switch to golang? Personally using TS, but also have golang coding exp.
s
We recently did a project in golang it really enjoyed it so thought we would use it for this new project. I have actually just found that after the Apply func you can do:
Copy code
rancherInstanceInternalIP := rancherInstance.NetworkInterfaces.ApplyT(func(iface []compute.InstanceNetworkInterface) *string {
			return iface[0].NetworkIp
		}).(pulumi.StringPtrInput)
// The change I have made here is adding .(pulumi.StringPtrInput) to make it a usable input
i
@silly-stone-79070 can’t you just use the value directly at the point you need the input? Pulumi should figure out the details on resolving it itself
s
I ended up going with typescript as I found the whole experience of pulumi in go more effort
f
TS in vscode is a very nice DevX :)