Skip to content

Hetzner Cloud ​

Status: available · package wg-flow-plugin-hetzner 0.1.0 · provider hetzner · category cloud.

The plugin calls the Hetzner Cloud API and sends the project into inventory. It needs a project API token. The token stays in the agent YAML.

Create the token in the Cloud project: Security → API tokens. The plugin only sends GET. One source is one project.

SSH keys, images, snapshots and ISOs are not emitted in 0.1.0.

Install ​

The agent must be connected to the API.

bash
docker compose exec agent wg-flow-agent plugin install hetzner
# or
wg-flow-agent plugin install hetzner

Then the local UI → Connections → hetzner, or YAML.

What lands in inventory ​

Hetzner objectresource_typeNotes
Cloud serverserverprovider_resource_id = server:{id}. running → active, off → stopped, transitional states → pending. Public IPv4 → metadata.primary_ipv4
Volumestoragevolume:{id}. available → active, creating → pending. Size in metadata.size_gb
Load balancerload_balancerlb:{id}. Public network enabled: false → stopped
Floating IPnetworkfloating-ip:{id}. blocked → error. IPv4 is also metadata.primary_ipv4
Primary IPnetworkprimary-ip:{id}, including an address that is not assigned to a server
Private networknetworknetwork:{id}. Region is the subnet network_zone
Firewallfirewallfirewall:{id}. Compact rule list in metadata
Certificatecertificatecertificate:{id}. Unusable or issuance error → pending / error. not_valid_after is the expiry

There is no separate ip type in inventory, so addresses are network with metadata.product floating_ip or primary_ip.

Collection pieces can be turned off separately. A disabled piece is omitted from the next successful sync, and inventory then marks those rows inactive. An API error fails the whole source, so a partial list is not sent.

Several projects are several sources. provider_account is the label you choose; the token itself selects the project.

YAML ​

yaml
plugins:
  hetzner:
    enabled: true
    sources:
      - id: prod
        provider_account: "hz-prod"
        sync_interval_seconds: 300
        url: "https://api.hetzner.cloud/v1"
        token: "…"
        collect_servers: true
        collect_volumes: true
        collect_load_balancers: true
        collect_floating_ips: true
        collect_primary_ips: true
        collect_networks: true
        collect_firewalls: true
        collect_certificates: true

Source fields ​

FieldRequiredDescription
idyesLog key (hetzner/prod)
provider_accountyesProject label in inventory
urlnoDefault https://api.hetzner.cloud/v1
tokenyesProject API token; masked in the UI
collect_*noDefault true. See the table above
sync_interval_secondsnoMinimum 300

Check ​

bash
wg-flow-agent status
wg-flow-agent dry-run

JSON shows provider: hetzner. Health calls GET /servers?per_page=1. The token is not stored in inventory.

Common errors ​

SymptomWhat to check
401 / 403Token belongs to this project and was copied in full
Empty serverscollect_servers is on; the project actually has servers
Volumes disappeared after a synccollect_volumes was turned off; inventory deactivates omitted rows
No public address on a serverThe server has no IPv4 (public_net.ipv4 is null). IPv6 is metadata.ipv6
Duplicates with another plugindifferent provider is expected; merge in the console