# golang


04/18/2021, 10:01 PM
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(""),
	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(""),
	if err != nil {
		return err
The NetworkID is of type
while the network.ID() returns a
I need to pass the network.ID() as the
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: which means the documentation is wrong. I can make a PR, if someone kindly help me with this. Thank you!