From 82e9a5e2a917e72870781d80d2de515c27208304 Mon Sep 17 00:00:00 2001 From: fuku Date: Tue, 5 Mar 2024 04:17:28 +0900 Subject: [PATCH] nifcloud: fix bug in case of same auth zone (#2125) Co-authored-by: Fernandez Ludovic --- providers/dns/nifcloud/nifcloud.go | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/providers/dns/nifcloud/nifcloud.go b/providers/dns/nifcloud/nifcloud.go index 8185eb30..b059e562 100644 --- a/providers/dns/nifcloud/nifcloud.go +++ b/providers/dns/nifcloud/nifcloud.go @@ -131,7 +131,15 @@ func (d *DNSProvider) Timeout() (timeout, interval time.Duration) { } func (d *DNSProvider) changeRecord(action, fqdn, value string, ttl int) error { + authZone, err := dns01.FindZoneByFqdn(fqdn) + if err != nil { + return fmt.Errorf("could not find zone: %w", err) + } + name := dns01.UnFqdn(fqdn) + if authZone == fqdn { + name = "@" + } reqParams := internal.ChangeResourceRecordSetsRequest{ XMLNs: internal.XMLNs, @@ -159,11 +167,6 @@ func (d *DNSProvider) changeRecord(action, fqdn, value string, ttl int) error { }, } - authZone, err := dns01.FindZoneByFqdn(fqdn) - if err != nil { - return fmt.Errorf("could not find zone: %w", err) - } - ctx := context.Background() resp, err := d.client.ChangeResourceRecordSets(ctx, dns01.UnFqdn(authZone), reqParams)