polite-motherboard-78438
04/18/2021, 10:01 PMnetwork, err := hcloud.NewNetwork(ctx, "internal", &hcloud.NetworkArgs{
IpRange: pulumi.String("10.0.1.0/24"),
})
if err != nil {
return err
}
_, err = hcloud.NewNetworkSubnet(ctx, "default", &hcloud.NetworkSubnetArgs{
NetworkId: network.ID(),
Type: pulumi.String("cloud"),
NetworkZone: pulumi.String("eu-central"),
IpRange: pulumi.String("10.0.1.0/24"),
})
if err != nil {
return err
}
The NetworkID is of type pulumi.IntInput
while the network.ID() returns a pulumi.IDOutput
I need to pass the network.ID() as the NetworkId
on the subnet. With this I get C`annot use 'network.ID()' (type IDOutput) as type pulumi.IntInput`
I tried to do something like this, but I am getting into a mental loop and no ideia how to convert the value:
NetworkId: network.ID().ApplyInt(func(i pulumi.IDOutput) (pulumi.IntInput, error) {
return i // WHAT TO DO HERE
}),
How can I get this working? If there is one thing I have trouble is this Apply stuff.
Btw, this example is from the Hetzner provider documentation: https://www.pulumi.com/docs/reference/pkg/hcloud/servernetwork/ which means the documentation is wrong. I can make a PR, if someone kindly help me with this. Thank you!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.
Powered by