Anyone here using the Hetzner provider and knows how to get the private IP from an instance as an output
l
limited-rainbow-51650
05/24/2024, 8:02 AM
@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
late-chef-72896
05/24/2024, 10:44 AM
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
limited-rainbow-51650
05/24/2024, 11:34 AM
What about
node.Networks[<index>].Ip
?
l
late-chef-72896
05/24/2024, 11:35 AM
hmm, I'll try that later on today. Thanks for the pointer
late-chef-72896
05/25/2024, 5:35 AM
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)
No matter how you like to participate in developer communities, Pulumi wants to meet you there. If you want to meet other Pulumi users to share use-cases and best practices, contribute code or documentation, see us at an event, or just tell a story about something cool you did with Pulumi, you are part of our community.