Skip to content

Network

Source: src/Hetzner/Network.ts

A Hetzner Cloud private Network — an isolated IPv4 range that Cloud Servers and Load Balancers attach to. Subnets, routes, delete protection, and labels are synced on the Network itself; network_actions are not modeled as their own resources.

Basic Network

const network = yield* Hetzner.Network("vpc", {
ipRange: "10.0.0.0/16",
});

Network with a cloud subnet

const network = yield* Hetzner.Network("vpc", {
ipRange: "10.0.0.0/16",
subnets: [
{ type: "cloud", ipRange: "10.0.1.0/24", networkZone: "eu-central" },
],
});
const network = yield* Hetzner.Network("vpc", {
ipRange: "10.0.0.0/16",
subnets: [
{ type: "cloud", ipRange: "10.0.1.0/24", networkZone: "eu-central" },
],
routes: [{ destination: "10.10.0.0/24", gateway: "10.0.1.2" }],
deleteProtection: true,
});
const network = yield* Hetzner.Network("vpc", {
ipRange: "10.0.0.0/16",
labels: { env: "prod", role: "vpc" },
});