terraform-hcloud-hetzner-node-pool terraform module

October 16, 2025 ยท View on GitHub

Terraform module which creates terraform-hcloud-hetzner-node-pool resources. The module can be found on the terraform.io registry or on github.

Usage

See examples directory for working examples to reference:

module "hetzner_node_pool" {
  source = "hegerdes/terraform-hcloud-hetzner-node-pool/"

  size     = 1
  name     = "example"
  location = "fsn1"
  tags     = {cloud = "true"}
}

NOTE: Due to an issue in the hetzner terraform provider, it is currently not possible to set firewall ids via labels and via the firewall_ids input. Users have to decide for one of these methods.

Examples

Examples codified under the examples are intended to give users references for how to use the module(s) as well as testing/validating changes to the source code of the module. If contributing to the project, please be sure to make any appropriate updates to the relevant examples to allow maintainers to test your changes and to keep the examples up to date for users. Thank you!

Requirements

NameVersion
terraform>= 1.5
hcloud>=1.40
random>=3.0

Providers

NameVersion
hcloud>=1.40
random>=3.0

Modules

No modules.

Resources

NameType
hcloud_placement_group.thisresource
hcloud_server.thisresource
hcloud_ssh_key.thisresource
hcloud_volume.thisresource
random_string.thisresource
hcloud_image.thisdata source
hcloud_network.thisdata source

Inputs

NameDescriptionTypeDefaultRequired
backupsBackups enabledboolfalseno
create_ssh_keysHetzner allows create a ssh key only once. By default you have to create them before. If you set this flag the module will create them.boolfalseno
firewall_idsIds of firewall attacted to the serverlist(string)nullno
fixed_disk_sizeWhether the disk size should also be upgraded when scaling up. If true, downgrades may not be possible anymore.boolfalseno
imageNode image name.string"debian-13"no
instance_typeNode instance type.string"cx23"no
locationNode location.stringn/ayes
nameNode name prefix.stringn/ayes
network_nameNode network namestringnullno
private_ip_addressesNode private ips. Network name must be set for this.list(string)[]no
public_ipv4Node public ipv4 ipbooltrueno
public_ipv6Node public ipv6 ipbooltrueno
shutdown_before_deletionWill issue a shutdown command before deleting the server.boolfalseno
sizeNumber of nodes to create. Will only be used if vm_names is empty.number1no
snapshot_imageNode image is snapshotboolfalseno
ssh_keysNodes public ssh keys ids or names or the key itself. If its the key you have to set create_ssh_keys.list(string)[]no
tagsNode tags/labelsany{}no
user_dataNode user data (cloud-init)stringnullno
vm_namesList of names for the VMs. to createlist(string)[]no
volumesExtra Hetzer volumes added to each server.
list(object({
name = string
size = number
format = optional(string, "ext4")
}))
[]no

Outputs

NameDescription
nameThe name of the node pool.
vm_idsList of all ids for every created server.
vm_ipsList of all public ips of every created server. Includes IPv4 & IPv6.
vm_namesList of all names for every created server.
vm_volumesList of all additional disks for every created server.
vmsObject of vm data based on name.
vms_rawRaw object of hcloud server objects.

License

Apache-2.0 Licensed. See LICENSE.