Example: hetzner-lan
terraform/examples/hetzner-lan is the smallest Hetzner root: one group of
three nodes on one private network, the cluster plane on the private
interface, no load balancer and no DNS. The public firewall admits SSH only.
What differs
Section titled “What differs”- One node group,
nodes, sized bynode_count. nic_namepins the plane interface. Hetzner attaches the private network asenp7s0on cx and cpx servers; the ladder left it to the module’s derivation, which picks the same.routes = []is where static return routes would go for networks behind a router on the same LAN.firewall.inter_nodestays unset, as in the ladder: with a private plane it derives tonone.- No
topology: nothing on the platform beyond the cluster itself.
node_groups = { nodes = { count = var.node_count, server_type = var.server_type, runtime = var.runtime, control_plane = true } }
networking = { private = true ip_range = var.network_cidr subnet = var.subnet_cidr } nic_name = var.private_nic routes = [] firewall = { public_ports = [] }Running it
Section titled “Running it”The key is yours. Make one, put the public half in your login shell as
TF_VAR_ssh_public_key the way page 00 placed HCLOUD_TOKEN, and name the
private file with ssh_private_key_path in the tfvars. TF_VAR_vault_pw
holds the vault password; this ladder’s is P@ssw0rd. Three nodes need the
licence before the first join, as on page 02: license_token_path names the
token file you put on work. Without it the example consents to the trial,
which does not include clustering, and both joins are refused.
shc_version names the release every node installs by apt, as on page 01.
server_type is the ladder’s cx23, enough for three nodes that only form a
cluster; the example’s own default is the larger cx33.
The root runs in place inside the checkout, so its ../../modules source
resolves.
cluster_name = "lan"shc_version = "0.1.3"server_type = "cx23"ssh_private_key_path = "~/.ssh/learn"license_token_path = "~/shc-license.token"$ ssh-keygen -t ed25519 -N "" -f ~/.ssh/learn...$ test -n "$TF_VAR_ssh_public_key"$ test -n "$TF_VAR_vault_pw"$ tofu -chdir=learn/shc/terraform/examples/hetzner-lan init...OpenTofu has been successfully initialized!...$ tofu -chdir=learn/shc/terraform/examples/hetzner-lan plan...$ tofu -chdir=learn/shc/terraform/examples/hetzner-lan apply -auto-approve...$ tofu -chdir=learn/shc/terraform/examples/hetzner-lan output node_names[ "nodes01.lan", "nodes02.lan", "nodes03.lan",]The destroy needs the consent page 07 gave. The example takes it as the same variable, and it is read from state, so apply it first.
cluster_name = "lan"shc_version = "0.1.3"server_type = "cx23"ssh_private_key_path = "~/.ssh/learn"license_token_path = "~/shc-license.token"on_destroy = "force"$ tofu -chdir=learn/shc/terraform/examples/hetzner-lan apply -auto-approve...$ tofu -chdir=learn/shc/terraform/examples/hetzner-lan destroy -auto-approve...Next: Example: hetzner-lan-lb.