-
Notifications
You must be signed in to change notification settings - Fork 650
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unlock unicode domain support in 'cloudflare_zone' #399
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ad-m Appreciate the time you've taken to submit the PR! I have a couple of questions:
- Why are we completely removing the regular expression here? Wouldn't you just want to expand upon it? The only change I think is actually needed is the length of string that is accepted.
- Have you confirmed any length restrictions of domains with Cloudflare Support? If not, I'd suggest we double check this before we put any additional restrictions into the validation.
No, this is not true. The expression does not accept characters such as
I'm not a CloudFlare employee, I did not contact CloudFlare support. I just want to be able to manage a domain that contains characters like |
Right, I misunderstood what you initially meant here. I thought you meant that you had to input resource "cloudflare_zone" "foo" {
zone = "zajęzyk.pl"
} You will be able to keep Going forward there are a couple of options:
|
CloudFlare API already return unicode-encoded (no punycode) values. Why state would be |
Are you able to provide your actual configuration and HTTP responses you're seeing? It's not completely clear which parts are not working for you and I'd like to make sure we're addressing the right thing here. |
Hi! Having this issue myself. Unicode domain names not accepted by the regex validator, Punycoded ones do work, here with the fictitious domain provider "cloudflare" {
version = "~> 1.16"
}
resource "cloudflare_zone" "test_domain" {
# Punycoded version of äää.fi
zone = "xn--4caaa.fi"
} Initial {
"version": 4,
"terraform_version": "0.12.3",
"resources": [
{
"mode": "managed",
"type": "cloudflare_zone",
"name": "test_domain",
"provider": "provider.cloudflare",
"instances": [
{
"attributes": {
"id": "123",
"zone": "äää.fi"
}
}
]
}
]
} Subsequent $ terraform apply
Terraform will perform the following actions:
# cloudflare_zone.test_domain must be replaced
-/+ resource "cloudflare_zone" "test_domain" {
... values omitted
~ zone = "äää.fi" -> "xn--4caaa.fi" # forces replacement
}
Plan: 1 to add, 0 to change, 1 to destroy. Regarding the regex validation: since Cloudflare API validates the domain name anyways (e.g. rejecting non-registered domain names), I think dropping the regex wouldn't be that big of a deal? Writing a regex that covers all the cases seems non-trivial Thanks! |
Thanks for the additional information here @codeflows, the issue is becoming clearer now. My understanding now is that we probably need two things to happen:
Does this seem reasonable? |
Why we need to handle puny-encoded domain? Can we solve that through documentation? |
We can definitely add documentation however for something like this that we can tuck away in the Terraform schema itself and have it Just Work™ for people, I'm all for. Regardless of what people put in there, we will support it and not have Terraform perform unexpectedly. |
Sounds good to me :) |
@ad-m Would you like to update this PR to implement the suggestions above or would you prefer someone else take a pass at them? |
I can also try implementing the suggestions if need be |
I would you prefer someone else take a pass at them. I don't have any Go experience. |
Addressing both concerns in #412. |
Since RFC 3492 due punycode the range of allowable values for the field has significantly expanded. The correct zone is, for example, "zajęzyk.pl" (xn--zajzyk-y4a.pl).
The CloudFlare API returns domain addresses without Punycode encoding, i.e. with a huge number of characters, much larger than allowed in this regular expression.