diff --git a/providers/dns/ionos/ionos.go b/providers/dns/ionos/ionos.go index 6a778f2b..fc322c89 100644 --- a/providers/dns/ionos/ionos.go +++ b/providers/dns/ionos/ionos.go @@ -113,14 +113,15 @@ func (d *DNSProvider) Present(domain, _, keyAuth string) error { return fmt.Errorf("ionos: failed to get zones: %w", err) } - // TODO(ldez) replace domain by FQDN to follow CNAME. - zone := findZone(zones, domain) + name := dns01.UnFqdn(info.EffectiveFQDN) + + zone := findZone(zones, name) if zone == nil { return errors.New("ionos: no matching zone found for domain") } filter := &internal.RecordsFilter{ - Suffix: dns01.UnFqdn(info.EffectiveFQDN), + Suffix: name, RecordType: "TXT", } @@ -130,7 +131,7 @@ func (d *DNSProvider) Present(domain, _, keyAuth string) error { } records = append(records, internal.Record{ - Name: dns01.UnFqdn(info.EffectiveFQDN), + Name: name, Content: info.Value, TTL: d.config.TTL, Type: "TXT", @@ -155,14 +156,15 @@ func (d *DNSProvider) CleanUp(domain, _, keyAuth string) error { return fmt.Errorf("ionos: failed to get zones: %w", err) } - // TODO(ldez) replace domain by FQDN to follow CNAME. - zone := findZone(zones, domain) + name := dns01.UnFqdn(info.EffectiveFQDN) + + zone := findZone(zones, name) if zone == nil { return errors.New("ionos: no matching zone found for domain") } filter := &internal.RecordsFilter{ - Suffix: dns01.UnFqdn(info.EffectiveFQDN), + Suffix: name, RecordType: "TXT", } @@ -172,7 +174,7 @@ func (d *DNSProvider) CleanUp(domain, _, keyAuth string) error { } for _, record := range records { - if record.Name == dns01.UnFqdn(info.EffectiveFQDN) && record.Content == strconv.Quote(info.Value) { + if record.Name == name && record.Content == strconv.Quote(info.Value) { err = d.client.RemoveRecord(ctx, zone.ID, record.ID) if err != nil { return fmt.Errorf("ionos: failed to remove record (zone=%s, record=%s): %w", zone.ID, record.ID, err)