terraform-coop / terraform-provider-foreman

Terraform provider for Foreman
https://registry.terraform.io/providers/terraform-coop/foreman
Mozilla Public License 2.0
33 stars 31 forks source link

Change URL regex to allow for valid FQDN #28

Closed covert8 closed 3 years ago

covert8 commented 3 years ago

Hi, thank you for all your work.

The current regex is a bit too strict, for example "https://foreman-smartproxy-1.our.domain.com" should be correct. However the current regex only allows for alpha numeric characters. the proposed change would only add dashes.

However making a RFC compliant regex is non trivial, below mentioned packages could offload that responsibility. net/url .pase() could also be used asaskevich/govalidator .isURL() is also another option

lhw commented 3 years ago

You were absolutely correct. And the terraform sdk already comes with a solution for this issue. I switched over the validation to their built-in http/https validation function in 59b76c0