diff --git a/providers/dns/nifcloud/nifcloud.go b/providers/dns/nifcloud/nifcloud.go index 8185eb3054..b059e562ea 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)