From 022092bc6899f6298f0fbf1685cc016d9441e00f Mon Sep 17 00:00:00 2001 From: Ferdinando Formica Date: Mon, 16 Sep 2024 13:21:51 +0100 Subject: [PATCH] Allow IDN TLDs in redirect domain (#329) --- CHANGELOG.md | 3 +++ ns1/config.go | 2 +- ns1/resource_redirect.go | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fc92d74f..ceefe433 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## 2.4.2 (September 16, 2024) +* Modified domain regex for redirects to allow internationalised domains + ## 2.4.1 (August 23, 2024) * Fixed validation regex for redirects diff --git a/ns1/config.go b/ns1/config.go index 80b40619..d622c0e6 100644 --- a/ns1/config.go +++ b/ns1/config.go @@ -19,7 +19,7 @@ import ( ) var ( - clientVersion = "2.4.1" + clientVersion = "2.4.2" providerUserAgent = "tf-ns1" + "/" + clientVersion defaultRetryMax = 3 ) diff --git a/ns1/resource_redirect.go b/ns1/resource_redirect.go index bbe089f6..1ac23151 100644 --- a/ns1/resource_redirect.go +++ b/ns1/resource_redirect.go @@ -338,7 +338,7 @@ func RedirectCertUpdate(d *schema.ResourceData, meta interface{}) error { func validateDomain(val interface{}, key string) (warns []string, errs []error) { v := val.(string) - match, err := regexp.MatchString("^(\\*\\.)?([a-zA-Z0-9\\-]+\\.)+[a-zA-Z0-9]+$", v) + match, err := regexp.MatchString("^(\\*\\.)?([a-zA-Z0-9-]{1,63}\\.)+[a-zA-Z0-9-]{0,62}[a-zA-Z0-9]$", v) if err != nil { errs = append(errs, fmt.Errorf("%s is invalid, got: %s, error: %e", key, v, err)) }