Skip to content

dhoppeIT/terraform-hcloud-config

Repository files navigation

terraform-hcloud-config

Terraform module to manage the Hetzner Cloud resources.

Graph

Graph

Usage

Copy and paste into your Terraform configuration, insert the variables and run terraform init:

module "hcloud_ssh_key" {
  source = "dhoppeIT/ssh_key/hcloud"

  name       = "terraform"
  public_key = "~/.ssh/id_terraform.pub"
}

module "hcloud_network" {
  source = "dhoppeIT/network/hcloud"

  name             = "private"
  ip_range_network = "10.0.0.0/16"

  type            = "cloud"
  ip_range_subnet = ["10.0.0.0/24"]
  network_zone    = "eu-central"
}

module "hcloud_firewall" {
  source = "dhoppeIT/firewall/hcloud"

  name = "default"
  rule = [
    {
      direction  = "in"
      protocol   = "icmp"
      source_ips = ["0.0.0.0/0"]
    },
    {
      direction  = "in"
      protocol   = "tcp"
      port       = "22"
      source_ips = ["0.0.0.0/0"]
    },
    {
      direction       = "out"
      protocol        = "icmp"
      destination_ips = ["0.0.0.0/0"]
    },
    {
      direction       = "out"
      protocol        = "tcp"
      port            = "53"
      destination_ips = ["0.0.0.0/0"]
    },
    {
      direction       = "out"
      protocol        = "udp"
      port            = "53"
      destination_ips = ["0.0.0.0/0"]
    },
    {
      direction       = "out"
      protocol        = "tcp"
      port            = "80"
      destination_ips = ["0.0.0.0/0"]
    },
    {
      direction       = "out"
      protocol        = "tcp"
      port            = "443"
      destination_ips = ["0.0.0.0/0"]
    }
  ]
}

Requirements

Name Version
terraform >= 1.0
hcloud ~> 1.0

Providers

No providers.

Modules

Name Source Version
hcloud_firewall dhoppeIT/firewall/hcloud ~> 0.2
hcloud_network dhoppeIT/network/hcloud ~> 0.3
hcloud_ssh_key dhoppeIT/ssh_key/hcloud ~> 0.2

Resources

No resources.

Inputs

No inputs.

Outputs

No outputs.

Authors

Created and maintained by Dennis Hoppe.

License

Apache 2 licensed. See LICENSE for full details.