Skip to content

knoedel/terraform-cloud-server

Repository files navigation

Manages Cloud Server

This module provisions a Hetzner Cloud server instance.

Usage

Put an example usage of the module here

module "cloud-server" {
  source = "github.com/knoedel/terraform-cloud-server"

  <variables>
}

Requirements

Name Version
terraform ~> 1.0
cloudinit 2.2.0
hcloud 1.31.1

Providers

Name Version
cloudinit 2.2.0
hcloud 1.31.1

Modules

No modules.

Resources

Name Type
hcloud_server.server resource
hcloud_server_network.external resource
hcloud_server_network.internal resource
cloudinit_config.main data source

Inputs

Name Description Type Default Required
domain The domain name of your cloud server. string n/a yes
external_network_id The id of the external network to connect your cloud server to. number n/a yes
firewall_ids The ids of the firewall rule sets to apply on your cloud server. list(number) [] no
internal_network_id The id of the internal network to connect your cloud server to. number n/a yes
mounts The list of volumes to mount on your cloud server.
list(object({
device = string,
path = string
}))
[] no
puppet_role The Puppet role to assign to your cloud server. string n/a yes
puppet_server The address of your Puppet server that your cloud server should connect to. string n/a yes
puppet_zone The Puppet zone to assign to your cloud server. string n/a yes
server_image The name or id of the image of your cloud server. string "ubuntu-20.04" no
server_location The location where to place your cloud server in. string "nbg1" no
server_name The name of your cloud server. Must be unique per project and a valid hostname as per RFC 1123. string n/a yes
server_type The type of your cloud server. string "cx11" no
ssh_key_id The id of the ssh key that is allowed to connect to your cloud server. number n/a yes
user_data The cloud-init configuration to apply to your cloud server. string n/a yes

Outputs

Name Description
external_ip The external IPv4 address of your cloud server
internal_ip The internal IPv4 address of your cloud server
ipv4 The public IPv4 address of your cloud server
ipv6 The public IPv6 address of your cloud server
server_id The id of your cloud server

Developer Setup

Install dependencies (macOS)

brew install pre-commit go terraform terraform-docs
make ensure_pre_commit

Testing

Terratest is being used for automated testing with this module. Tests in the test folder can be run locally by running the following command:

make test