Skip to content

hegerdes/terraform-hcloud-hetzner-node-pool

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

27 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

terraform-hcloud-hetzner-node-pool terraform module

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

Name Version
terraform >= 1.5
hcloud >=1.40
random >=3.0

Providers

Name Version
hcloud >=1.40
random >=3.0

Modules

No modules.

Resources

Name Type
hcloud_placement_group.this resource
hcloud_server.this resource
hcloud_ssh_key.this resource
hcloud_volume.this resource
random_string.this resource
hcloud_image.this data source
hcloud_network.this data source

Inputs

Name Description Type Default Required
backups Backups enabled bool false no
create_ssh_keys Hetzner 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. bool false no
firewall_ids Ids of firewall attacted to the server list(string) null no
fixed_disk_size Whether the disk size should also be upgraded when scaling up. If true, downgrades may not be possible anymore. bool false no
image Node image name. string "debian-12" no
instance_type Node instance type. string "cx22" no
location Node location. string n/a yes
name Node name prefix. string n/a yes
network_name Node network name string null no
private_ip_addresses Node private ips. Network name must be set for this. list(string) [] no
public_ipv4 Node public ipv4 ip bool true no
public_ipv6 Node public ipv6 ip bool true no
shutdown_before_deletion Will issue a shutdown command before deleting the server. bool false no
size Number of nodes to create. Will only be used if vm_names is empty. number 1 no
snapshot_image Node image is snapshot bool false no
ssh_keys Nodes public ssh keys ids or names or the key itself. If its the key you have to set create_ssh_keys. list(string) [] no
tags Node tags/labels any {} no
user_data Node user data (cloud-init) string null no
vm_names List of names for the VMs. to create list(string) [] no
volumes Extra Hetzer volumes added to each server.
list(object({
name = string
size = number
format = optional(string, "ext4")
}))
[] no

Outputs

Name Description
name The name of the node pool.
vm_ids List of all ids for every created server.
vm_ips List of all public ips of every created server. Includes IPv4 & IPv6.
vm_names List of all names for every created server.
vm_volumes List of all additional disks for every created server.
vms Object of vm data based on name.
vms_raw Raw object of hcloud server objects.

License

Apache-2.0 Licensed. See LICENSE.