flokoe / terraform-hcloud-server-module

Terraform module which creates a server on Hetzner Cloud.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Heztner Cloud Server Terraform module

Terraform module which creates a server on Hetzner Cloud.

Usage

Single Server

module "hcloud_server" {
  source  = "github.com/flokoe/terraform-hcloud-server-module"
  version = "0.1.0"

  name = "single-server"

  image       = "debian-11"
  server_type = "cx11"
}

Multiple Servers

module "hcloud_server" {
  source  = "github.com/flokoe/terraform-hcloud-server-module"
  version = "0.1.0"

  for_each = toset(["one", "two", "three"])

  name = "server-${each.key}"

  image       = "debian-11"
  server_type = "cx11"
}

Requirements

Name Version
terraform >= 1.4.0
hcloud ~> 1.36.2

Providers

Name Version
hcloud 1.36.2

Modules

No modules.

Resources

Name Type
hcloud_rdns.ipv4 resource
hcloud_rdns.ipv6 resource
hcloud_server.this resource
hcloud_server_network.this resource

Inputs

Name Description Type Default Required
alias_ips Additional IPs to be assigned to this server. list(string) [] no
attach_private_network If true, attach server to an existing private network. bool false no
backups Enable or disable backups. bool false no
delete_protection Enable or disable delete protection. bool false no
firewall_ids Firewall IDs the server should be attached to on creation. list(string) [] no
image Name or ID of the image the server is created from. string "debian-11" no
ip IP to request to be assigned to this server. string null no
keep_disk If true, do not upgrade the disk. This allows downgrading the server type later. bool false no
labels User-defined labels (key-value pairs) should be created with. map(string) {} no
location The location name to create the server in. string null no
name Name of the server to create (must be unique per project and a valid hostname as per RFC 1123). string n/a yes
network_id ID of the network which should be added to the server. number null no
placement_group_id Placement Group ID the server added to on creation. string null no
primary_ipv4_id ID of existing or external IPv4 address. string null no
primary_ipv6_id ID of existing or external IPv6 address. string null no
public_ipv4_enabled Enable or disable public IPv4 address. bool true no
public_ipv6_enabled Enable or disable public IPv6 address. bool true no
rdns Domain for reverse DNS entry. string null no
rebuild_protection Enable or disable rebuild protection. bool false no
server_type Name of the server type this server should be created with. string "cx11" no
ssh_keys SSH key IDs or names which should be injected into the server at creation time. list(string) [] no
subnet_id ID of the sub-network which should be added to the server. string null no
user_data Cloud-Init user data to use during server creation. string null no

Outputs

Name Description
id Unique ID of the server
name Name of the server
public_ipv4_address The public IPv4 address

License

MIT Licensed. See LICENSE for full details.

About

Terraform module which creates a server on Hetzner Cloud.

License:MIT License


Languages

Language:HCL 100.0%