# Hetzner-Specific Examples

Production patterns for Hetzner Cloud.

## Hetzner Cloud Servers

```nickel
{
  hetzner = {
    location = "fsn1",

    servers = [
      {
        name = "web-01",
        server_type = "cx21",
        image = "ubuntu-22.04",
        ssh_keys = ["my-key"],

        networks = [
          {
            network = "prod-network",
            ip = "10.0.0.11"
          }
        ],

        automount = true,

        labels = {
          env = "production",
          app = "web"
        }
      },
      {
        name = "db-01",
        server_type = "cx41",
        image = "ubuntu-22.04",
        location = "fsn1",

        volumes = [
          {
            size = 100,
            format = "ext4",
            automount = true,
            mount_point = "/data"
          }
        ]
      }
    ]
  }
}
```

## Hetzner Load Balancer

```nickel
{
  hetzner = {
    load_balancer = {
      name = "web-lb",
      load_balancer_type = "lb11",
      location = "fsn1",
      network_zone = "eu-central",

      public_interface = {
        enabled = true,
        ipv4 = {},
        ipv6 = {}
      },

      services = [
        {
          protocol = "http",
          listen_port = 80,
          destination_port = 80,
          proxyprotocol = false,

          health_check = {
            protocol = "http",
            port = 80,
            interval = 15,
            timeout = 10,
            unhealthy_threshold = 3
          }
        },
        {
          protocol = "https",
          listen_port = 443,
          destination_port = 443,
          certificate_id = 123
        }
      ],

      targets = [
        {
          type = "server",
          server_id = 42
        }
      ]
    }
  }
}
```

## Hetzner Network

```nickel
{
  hetzner = {
    network = {
      name = "prod-network",
      ip_range = "10.0.0.0/16"
    },

    subnets = [
      {
        network_id = 4711,
        type = "cloud",
        network_zone = "eu-central",
        ip_range = "10.0.0.0/24"
      }
    ]
  }
}
```

## Hetzner Firewall

```nickel
{
  hetzner = {
    firewall = {
      name = "prod-fw",
      labels = { env = "production" },

      rules = [
        {
          direction = "in",
          source_ips = ["0.0.0.0/0"],
          destination_ips = [],
          protocol = "tcp",
          port = "22"
        },
        {
          direction = "in",
          source_ips = ["0.0.0.0/0"],
          destination_ips = [],
          protocol = "tcp",
          port = "80"
        },
        {
          direction = "in",
          source_ips = ["0.0.0.0/0"],
          destination_ips = [],
          protocol = "tcp",
          port = "443"
        }
      ]
    }
  }
}
```

## Related Documentation

- [Hetzner Provider Guide](../infrastructure/provider-guides.md)
- [Multi-Cloud Examples](./multi-cloud.md)
