Skip to content

Conversation

@JonesH
Copy link

@JonesH JonesH commented Oct 23, 2025

Add Hetzner Cloud DNS provider (hetznerhcloud)

Summary

Implements DNS-01 challenge support for Hetzner Cloud DNS API (api.hetzner.cloud/v1/zones), distinct from the existing hetzner provider which targets the legacy DNS API (dns.hetzner.com).

Motivation

Hetzner Cloud customers managing DNS zones via the Cloud API require a unified token strategy. Current hetzner provider necessitates separate DNS-specific credentials, incompatible with Cloud
API tokens used for infrastructure-as-code workflows.

Implementation

Provider: 373 LOC total

  • Core: 140 lines implementing challenge.Provider interface
  • HTTP client: 108 lines (internal package)
  • Tests: 101 lines (76% coverage)
  • Metadata: 24 lines (TOML-driven documentation)

API Integration:

  • GET /v1/zones → Zone resolution with caching
  • POST /v1/zones/{id}/records → TXT record creation
  • DELETE /v1/zones/{id}/records/{id} → Record cleanup
  • Bearer token authentication
  • Thread-safe concurrent operation support

Patterns Followed:

  • Standard Lego provider interface (Present, CleanUp, Timeout)
  • Environment-based configuration via platform/config/env
  • Internal client package for HTTP abstraction
  • Auto-generated documentation from TOML metadata
  • Mutex-protected record ID caching for cleanup correlation

Testing

go test ./providers/dns/hetznerhcloud/...

PASS - 76% coverage, 3 test scenarios

Configuration

HCLOUD_TOKEN=xxx lego --dns hetznerhcloud -d example.com run

Optional: HCLOUD_TTL, HCLOUD_PROPAGATION_TIMEOUT, HCLOUD_POLLING_INTERVAL, HCLOUD_BASE_URL, HCLOUD_HTTP_TIMEOUT

Validation

  • ✅ Builds without errors
  • ✅ Tests pass with coverage
  • ✅ Documentation auto-generated via make generate-dns
  • ✅ Provider registered in zz_gen_dns_providers.go
  • ✅ CLI help integrated via zz_gen_cmd_dnshelp.go
  • ✅ Follows existing provider conventions

Related

@JonesH JonesH force-pushed the feature/hcloud-dns-provider branch 2 times, most recently from e05fa88 to 9684c89 Compare October 23, 2025 07:19
@JonesH JonesH force-pushed the feature/hcloud-dns-provider branch from 9684c89 to f78f6c5 Compare October 23, 2025 07:40
@ldez ldez closed this Oct 23, 2025
@ldez ldez added the declined label Oct 23, 2025
@ldez
Copy link
Member

ldez commented Oct 23, 2025

You should use your brain instead of AI.

Look for issues and PRs, and you will see that Hetzner Cloud DNS is already supported.

@ldez
Copy link
Member

ldez commented Oct 23, 2025

I ask you to sponsor the project for wasting my time -> https://donate.ldez.dev/

@ldez ldez changed the title Feature/hcloud dns provider - Oct 23, 2025
@JonesH
Copy link
Author

JonesH commented Oct 23, 2025

I'm so sorry I really didn't want to make you angry... good morning to you, too

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

2 participants