Hello. I am trying to create a Network subnet with...
# golang
p
Hello. I am trying to create a Network subnet with the Hetzner provider but I am having trouble passing an output from a resource as an input to another resource. I know I have to use Apply, but no idea how. Here is my code:
Copy code
network, 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:
Copy code
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!