Hi. How to create `hcloud` NetworkSubnet correct w...
# typescript
p
Hi. How to create
hcloud
NetworkSubnet correct way linked to Network, looks like docs examples outdated (https://www.pulumi.com/registry/packages/hcloud/api-docs/networksubnet/):
Copy code
import * as pulumi from "@pulumi/pulumi";
import * as hcloud from "@pulumi/hcloud";

const mynet = new hcloud.Network("mynet", {ipRange: "10.0.0.0/8"});
const foonet = new hcloud.NetworkSubnet("foonet", {
    networkId: mynet.id,
    type: "cloud",
    networkZone: "eu-central",
    ipRange: "10.0.1.0/24",
});
Because Network
network.id
is Output<string> and NetworkSubnet networkId is Input<number>. The same situation in Go version.
l
From looking at the bridged provider, it looks like the network id really is a number. The simplest way to cast it is
network.id.apply((idstring) => +idstring)
.
p
@little-cartoon-10569 Thanks. Already implemented similar solution
network.id.apply(Number.parseFloat)