Anyone here using the Hetzner provider and knows h...
# pulumiverse
l
Anyone here using the Hetzner provider and knows how to get the private IP from an instance as an output
l
@late-chef-72896 are you passing
Networks
to your
Server
resource? After creation, I would expect that in each of the networks in that array, the
Ip
property to be filled in with the actual (private) IP. Similar for public IPs is
PublicNets
.
l
yes, I use
Networks
but when I want to add all IPs
node.Ipv4Address
from a node creation in a for-loop to a list, the list is empty. For nodes where I use a public ip, I can see the IPs being added to the list using the same mechanism
l
What about
node.Networks[<index>].Ip
?
l
hmm, I'll try that later on today. Thanks for the pointer
ofcourse the IPs are assigned during server creation so I had to use
applyT
. This works
Copy code
ip := node.Networks.ApplyT(func(networks []hcloud.ServerNetworkType) string {
    return *networks[0].Ip
}).(pulumi.StringOutput)