dnscontrol/providers
Jakob Ackermann c073f2e654
HETZNER: gracefully handle FQDN labels when listing records (#3859)
- Closes https://github.com/StackExchange/dnscontrol/issues/3853

This PR is gracefully handling FQDN labels when listing records from the
Hetzner DNS Control api.

These records can be created via other tools or the browser UI.

Testing:

```diff
diff --git a/providers/hetzner/types.go b/providers/hetzner/types.go
index 964f1b7b..3429acc2 100644
--- a/providers/hetzner/types.go
+++ b/providers/hetzner/types.go
@@ -3,2 +3,3 @@ package hetzner
 import (
+       "fmt"
        "strings"
@@ -63,3 +64,3 @@ func fromRecordConfig(in *models.RecordConfig, zone zone) record {
        r := record{
-               Name:   in.GetLabel(),
+               Name:   in.GetLabelFQDN() + ".",
                Type:   in.Type,
@@ -69,2 +70,3 @@ func fromRecordConfig(in *models.RecordConfig, zone zone) record {
        }
+       fmt.Printf("CREATE: %q\n", r.Name)
 
@@ -93,2 +95,3 @@ func toRecordConfig(domain string, r *record) (*models.RecordConfig, error) {
        }
+       fmt.Printf("LISTING: %q\n", r.Name)
        if strings.HasSuffix(r.Name, "."+domain+".") {
```

Config:
```js
var REG_NONE = NewRegistrar('none')
var DSP = NewDnsProvider("HETZNER")

D('testing1.dev', REG_NONE, DnsProvider(DSP),
  A('@', '127.0.0.1'),
  A('foo', '127.0.0.1')
)
```

First push:
```
Waiting for concurrent gathering(s) to complete...LISTING: "@"
LISTING: "@"
LISTING: "@"
LISTING: "@"
CREATE: "foo.testing1.dev."
DONE
******************** Domain: testing1.dev
1 correction (HETZNER)
#1: Batch creation of records:
	+ CREATE A foo.testing1.dev 127.0.0.1 ttl=300
SUCCESS!
Done. 1 corrections.
```

Second push (no-op):
```
Waiting for concurrent gathering(s) to complete...LISTING: "@"
LISTING: "@"
LISTING: "@"
LISTING: "@"
LISTING: "foo.testing1.dev."
DONE
******************** Domain: testing1.dev
Done. 0 corrections.
```

DNS query:
```
$ dig foo.testing1.dev. @helium.ns.hetzner.de.
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 53563
foo.testing1.dev.	300	IN	A	127.0.0.1
```

Additional testing:
- update/delete `foo`  when record `foo.testing1.dev.` exists, works
- creating `foo.testing1.dev` is treated as
`foo.testing1.dev.testing1.dev.` in the API, hence the specific suffix
check for `<dot>DOMAIN<dot>`
- Test with HETZNER_V2, rejects records with FQDN

```
FAILURE! has dot (.) suffix (invalid_input, 50f9cf872ed8f1f808fd33c25cf88a81)
```

<!--
## Before submiting a pull request

Please make sure you've run the following commands from the root
directory.

    bin/generate-all.sh

(this runs commands like "go generate", fixes formatting, and so on)

## Release changelog section

Help keep the release changelog clear by pre-naming the proper section
in the GitHub pull request title.

Some examples:
* CICD: Add required GHA permissions for goreleaser
* DOCS: Fixed providers with "contributor support" table
* ROUTE53: Allow R53_ALIAS records to enable target health evaluation

More examples/context can be found in the file .goreleaser.yml under the
'build' > 'changelog' key.
!-->
2025-12-01 09:08:43 -05:00
..
_all VERCEL: Implement Vercel DNS Provider (#3379) (#3542) 2025-12-01 08:41:56 -05:00
adguardhome NEW PROVIDER: ADGUARDHOME (#3638) 2025-07-09 12:06:34 -04:00
akamaiedgedns AKAMAIEDGEDNS: Add ALIAS and AKAMAITLC support to the Akamai Edge DNS provider (#3836) 2025-11-14 09:48:42 -05:00
autodns POWERDNS: Zone creation now abides by variant tags (#3830) 2025-11-05 09:33:47 -05:00
axfrddns AXFRDDNS: Chunk large changes in multiple packets (#3732) 2025-08-28 12:27:18 -04:00
azuredns POWERDNS: Zone creation now abides by variant tags (#3830) 2025-11-05 09:33:47 -05:00
azureprivatedns POWERDNS: Zone creation now abides by variant tags (#3830) 2025-11-05 09:33:47 -05:00
bind BUGFIX: IDN support is broken for domain names (#3845) 2025-11-29 12:17:44 -05:00
bunnydns POWERDNS: Zone creation now abides by variant tags (#3830) 2025-11-05 09:33:47 -05:00
cloudflare CLOUDFLAREAPI: Skip read-only records inserted by provider (#3850) (#3852) 2025-11-24 20:28:38 -05:00
cloudns POWERDNS: Zone creation now abides by variant tags (#3830) 2025-11-05 09:33:47 -05:00
cnr POWERDNS: Zone creation now abides by variant tags (#3830) 2025-11-05 09:33:47 -05:00
cscglobal Warn if IGNORE() is unreliable for this provider (#3683) 2025-07-30 20:41:49 -04:00
desec POWERDNS: Zone creation now abides by variant tags (#3830) 2025-11-05 09:33:47 -05:00
digitalocean CHORE: Maintainer changes for OPENSRS and DIGITALOCEAN (#3849) 2025-11-24 20:29:43 -05:00
dnsimple Warn if IGNORE() is unreliable for this provider (#3683) 2025-07-30 20:41:49 -04:00
dnsmadeeasy POWERDNS: Zone creation now abides by variant tags (#3830) 2025-11-05 09:33:47 -05:00
doh
domainnameshop Warn if IGNORE() is unreliable for this provider (#3683) 2025-07-30 20:41:49 -04:00
dynadot
easyname
exoscale POWERDNS: Zone creation now abides by variant tags (#3830) 2025-11-05 09:33:47 -05:00
fortigate POWERDNS: Zone creation now abides by variant tags (#3830) 2025-11-05 09:33:47 -05:00
gandiv5 GANDI_V5: Increase API timeouts (#3770) 2025-09-15 14:02:47 -04:00
gcloud POWERDNS: Zone creation now abides by variant tags (#3830) 2025-11-05 09:33:47 -05:00
gcore POWERDNS: Zone creation now abides by variant tags (#3830) 2025-11-05 09:33:47 -05:00
hedns POWERDNS: Zone creation now abides by variant tags (#3830) 2025-11-05 09:33:47 -05:00
hetzner HETZNER: gracefully handle FQDN labels when listing records (#3859) 2025-12-01 09:08:43 -05:00
hetznerv2 HETZNER_V2: Add provider for Hetzner DNS API (#3837) 2025-11-30 09:14:54 -05:00
hexonet POWERDNS: Zone creation now abides by variant tags (#3830) 2025-11-05 09:33:47 -05:00
hostingde POWERDNS: Zone creation now abides by variant tags (#3830) 2025-11-05 09:33:47 -05:00
huaweicloud POWERDNS: Zone creation now abides by variant tags (#3830) 2025-11-05 09:33:47 -05:00
internetbs
inwx INWX: Fix INWX provider after their unexpected data-type breaking-change (#3855) 2025-11-29 12:17:13 -05:00
joker POWERDNS: Zone creation now abides by variant tags (#3830) 2025-11-05 09:33:47 -05:00
linode Warn if IGNORE() is unreliable for this provider (#3683) 2025-07-30 20:41:49 -04:00
loopia security fix: Prevent exposure of creds in debug output (#3733) 2025-08-19 10:47:02 -04:00
luadns POWERDNS: Zone creation now abides by variant tags (#3830) 2025-11-05 09:33:47 -05:00
mythicbeasts MYTHICBEASTS: Mark as concurrent verified. (#3631) 2025-06-20 10:50:22 -04:00
namecheap NAMECHEAP: Enable get-zones (#3775) 2025-09-29 13:43:03 -04:00
namedotcom Warn if IGNORE() is unreliable for this provider (#3683) 2025-07-30 20:41:49 -04:00
netcup NETCUP: add TLSA support (#3802) 2025-10-23 10:41:35 -04:00
netlify Warn if IGNORE() is unreliable for this provider (#3683) 2025-07-30 20:41:49 -04:00
ns1 POWERDNS: Zone creation now abides by variant tags (#3830) 2025-11-05 09:33:47 -05:00
opensrs CHORE: Maintainer changes for OPENSRS and DIGITALOCEAN (#3849) 2025-11-24 20:29:43 -05:00
oracle POWERDNS: Zone creation now abides by variant tags (#3830) 2025-11-05 09:33:47 -05:00
ovh
packetframe Warn if IGNORE() is unreliable for this provider (#3683) 2025-07-30 20:41:49 -04:00
porkbun CHORE: Upgrade github.com/failsafe-go/failsafe-go v0.6.9 to v0.7.0 (#3760) 2025-09-02 10:59:45 -04:00
powerdns BUGFIX: IDN support is broken for domain names (#3845) 2025-11-29 12:17:44 -05:00
realtimeregister POWERDNS: Zone creation now abides by variant tags (#3830) 2025-11-05 09:33:47 -05:00
route53 POWERDNS: Zone creation now abides by variant tags (#3830) 2025-11-05 09:33:47 -05:00
rwth Warn if IGNORE() is unreliable for this provider (#3683) 2025-07-30 20:41:49 -04:00
sakuracloud POWERDNS: Zone creation now abides by variant tags (#3830) 2025-11-05 09:33:47 -05:00
softlayer Warn if IGNORE() is unreliable for this provider (#3683) 2025-07-30 20:41:49 -04:00
transip
vercel VERCEL: Implement Vercel DNS Provider (#3379) (#3542) 2025-12-01 08:41:56 -05:00
vultr POWERDNS: Zone creation now abides by variant tags (#3830) 2025-11-05 09:33:47 -05:00
capabilities.go AKAMAIEDGEDNS: Add ALIAS and AKAMAITLC support to the Akamai Edge DNS provider (#3836) 2025-11-14 09:48:42 -05:00
capability_string.go AKAMAIEDGEDNS: Add ALIAS and AKAMAITLC support to the Akamai Edge DNS provider (#3836) 2025-11-14 09:48:42 -05:00
providers.go POWERDNS: Zone creation now abides by variant tags (#3830) 2025-11-05 09:33:47 -05:00