Skip to content

Ujstor/terraform-hetzner-modules

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hetzner Terraform Modules

Modules for simplifying the creation of resources on Hetzner Cloud and Cloudflare.

purple-divider

Module: cluster

Requirements

Name Version
cloudflare ~> 4.37
hcloud ~> 1.47
tls ~> 4.0

Providers

No providers.

Modules

Name Source Version
firewall ../network/firewall n/a
server ../server/ n/a
ssh_key ../ssh_key/ n/a

Resources

No resources.

Inputs

Name Description Type Default Required
firewall_config A map of firewalls to create
map(object({
name = string
labels = optional(map(string), {})
rules = list(object({
direction = string
protocol = string
port = string
source_ips = optional(list(string))
destination_ips = optional(list(string))
description = optional(string)
}))
}))
{} no
server_config Configuration for servers
map(object({
location = string
server_type = string
labels = optional(map(string))
ipv4_enabled = optional(bool)
ipv6_enabled = optional(bool)
subnet_id = string
subnet_ip = string
firewall_ids = optional(list(string))
}))
n/a yes
ssh_key_name Name of the SSH key string "cluster_hetzner_key" no
ssh_key_path Path to the SSH key string "~/.ssh" no
use_network Flag to use network bool true no

Outputs

Name Description
server_status n/a

purple-divider

Module: cloudflare_record

Requirements

Name Version
cloudflare ~> 4.37

Providers

Name Version
cloudflare ~> 4.37

Modules

No modules.

Resources

Name Type
cloudflare_record.domain_recorda resource

Inputs

Name Description Type Default Required
cloudflare_record Cloudflare record configuration
map(object({
zone_id = string
name = string
content = string
type = string
ttl = number
proxied = bool
}))
n/a yes

Outputs

No outputs.

purple-divider

Module: firewall

Requirements

Name Version
hcloud ~> 1.47

Providers

Name Version
hcloud ~> 1.47

Modules

No modules.

Resources

Name Type
hcloud_firewall.default resource

Inputs

Name Description Type Default Required
firewalls A map of firewalls to create
map(object({
name = string
labels = optional(map(string), {})
rules = list(object({
direction = string
protocol = string
port = string
source_ips = optional(list(string))
destination_ips = optional(list(string))
description = optional(string)
}))
}))
n/a yes

Outputs

Name Description
firewall_ids n/a
firewall_ids_list n/a

purple-divider

Module: loadbalancer

Requirements

Name Version
hcloud ~> 1.47

Providers

Name Version
hcloud ~> 1.47

Modules

No modules.

Resources

Name Type
hcloud_load_balancer.lb resource
hcloud_load_balancer_network.serve_network resource
hcloud_load_balancer_target.load_balancer_target resource

Inputs

Name Description Type Default Required
lb_config Load balancer configuration.
map(object({
name = string
load_balancer_type = string
network_zone = optional(string)
location = optional(string) #Require when no network_zone is set
algorithm = optional(object({ type = string }))
labels = optional(map(string))
load_balancer_targets = optional(object({
type = string #server, label_selector, ip
server_id = optional(string) #if type server
label_selector = optional(string)
ip = optional(string) #if type ip
use_private_ip = optional(bool) #if type server or label_selector
}))
load_balancer_network = optional(object({
#Use depends_on to make sure the network is created before the load balancer
network_id = optional(string) #or network id or subnet id
subnet_id = optional(string)
ip = optional(string) #subnet ip
}))
}))
n/a yes

Outputs

Name Description
lb_status n/a

purple-divider

Module: vpc_subnet

Requirements

Name Version
hcloud ~> 1.47

Providers

Name Version
hcloud ~> 1.47

Modules

No modules.

Resources

Name Type
hcloud_network.network resource
hcloud_network_subnet.deployment_subnet resource

Inputs

Name Description Type Default Required
network_type Network Type string "cloud" no
network_zone Network Zone string "eu-central" no
subnet_config Subnet Configuration
map(object({
subnet_ip_range = string
}))
n/a yes
vpc_config VPC Configuration
object({
vpc_name = string
vpc_ip_range = string
})
n/a yes

Outputs

Name Description
network_id The ID of the VPC network.
subnet_id The ID of the subnet.

purple-divider

Module: server

Requirements

Name Version
hcloud ~> 1.47

Providers

Name Version
hcloud ~> 1.47

Modules

No modules.

Resources

Name Type
hcloud_server.server resource
hcloud_server_network.subnet_controler resource

Inputs

Name Description Type Default Required
firewall_ids Firewall IDs to pass to the server list(string) null no
hcloud_ssh_key_id ID of the SSH key created and used for Hetzner cloud and serves list(string) n/a yes
os_type OS image to use for the server string "debian-12" no
server_config Config for each created server
map(object({
location = string
server_type = string
labels = optional(map(string))
ipv4_enabled = optional(bool)
ipv6_enabled = optional(bool)
subnet_id = optional(string)
subnet_ip = optional(string)
firewall_ids = optional(list(string))
}))
n/a yes
use_network Use VPC and subnets bool false no

Outputs

Name Description
server_info n/a

purple-divider

Module: ssh_key

Requirements

Name Version
hcloud ~> 1.47
tls ~> 4.0

Providers

Name Version
hcloud ~> 1.47
tls ~> 4.0

Modules

No modules.

Resources

Name Type
hcloud_ssh_key.default resource
tls_private_key.ssh_key resource

Inputs

Name Description Type Default Required
ssh_key_name Name of the SSH key created and used for Hetzner cloud and serves string "hetzner_ssh_key" no
ssh_key_path Path where the SSH key is stored string "~/.ssh" no

Outputs

Name Description
hcloud_ssh_key_id Pass Hcloud ssh key id into server
public_key Public key

purple-divider

Module: volumes

Requirements

Name Version
hcloud ~> 1.47

Providers

Name Version
hcloud ~> 1.47

Modules

No modules.

Resources

Name Type
hcloud_volume.vol resource
hcloud_volume_attachment.vol_attachment resource

Inputs

Name Description Type Default Required
volume_config Volume configuration
map(object({
size = number
location = string
server_id = string
}))
n/a yes
volume_format Format volume after creation (xfs or ext4) string "xfs" no

Outputs

No outputs.

purple-divider

About

Terraform modules for deploying Hetzner infrastructure

Resources

Stars

Watchers

Forks

Packages

No packages published