Skip to content
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

azurerm_public_ip domain_name_label incorrectly limited to 61 chars #2085

Closed
peterb154 opened this issue Oct 15, 2018 · 4 comments · Fixed by #2122
Closed

azurerm_public_ip domain_name_label incorrectly limited to 61 chars #2085

peterb154 opened this issue Oct 15, 2018 · 4 comments · Fixed by #2122

Comments

@peterb154
Copy link

peterb154 commented Oct 15, 2018

azurerm_public_ip domain_name_label incorrectly limited to 61 chars

Azure provider limits domain name labels to <= 61 chars
The RFC1035 says domain name labels must be <= 63 chars
Azure is allowing domain name labels of at least 64 chars

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform Version

Terraform v0.11.8
provider.azurerm v1.16.0

Affected Resource(s)

azurerm_public_ip

Terraform Configuration Files

resource "azurerm_public_ip" "rg-prod-cus-compute__aadds-f7ecdfea993c43bf9d2136af0a67a8d2-pip" {
   name = "aadds-f7ecdfea993c43bf9d2136af0a67a8d2-pip"
   location = "centralus"
   resource_group_name = "rg-prod-cus-compute"
   public_ip_address_allocation = "Dynamic" 
   sku = "Basic" 
   domain_name_label = "cust-c-u-s-0-x-x-x-x-x-x-x-f7ecdfea-993c-43bf-9d21-36af0a67a8d2"
   tags { 
    showback = "Compute" 
  }
}

note, replaced company name with x's above to protect privacy

Debug Output

N/A

Panic Output

N/A

Expected Behavior

terraform plan should be successful

Actual Behavior

terraform plan

Error: azurerm_public_ip.rg-prod-cus-compute__aadds-f7ecdfea993c43bf9d2136af0a67a8d2-pip: "domain_name_label" cannot be longer than 61 characters: "cust-c-u-s-0-x-x-x-x-x-x-x-f7ecdfea-993c-43bf-9d21-36af0a67a8d2"

Steps to Reproduce

Create a public IP resource with domain_name_label that is 62-63 chars long and run terraform plan

Important Factoids

  • Azure provider limits domain name labels to <= 61 chars
  • The RFC1035 says domain name labels must be <= 63 chars
  • Azure is allowing domain name labels of at least 64 chars

References

RFC1035 section 2.3.1 says "Labels must be 63 characters or less."

resource_arm_public_ip.go line 289 limits label name to 61 chars

	if len(value) > 61 {
		errors = append(errors, fmt.Errorf(
			"%q cannot be longer than 61 characters: %q", k, value))
	}

Azure is allowing domain_name_labels with 64 chars:

$ az network public-ip list -g rg-prod-cus-compute | jq .[].dnsSettings.domainNameLabel | sed s/\"//g 
cust-c-u-s-0-x-x-x-x-x-x-x-f7ecdfea-993c-43bf-9d21-36af0a67a8d2

$ az network public-ip list -g rg-prod-cus-compute | jq .[].dnsSettings.domainNameLabel | sed s/\"//g | wc -c
64
@peterb154 peterb154 changed the title publicIp domain_name_label incorrectly limits length to 61 chars azurerm_public_ip domain_name_label incorrectly limited to 61 chars Oct 15, 2018
@metacpp metacpp self-assigned this Oct 18, 2018
@katbyte
Copy link
Collaborator

katbyte commented Oct 20, 2018

Hi @peterb154,

Thanks for bringing this to our attention. I have opened #2122 that allows for 63 characters (as well as doing proper validation) as the API prevents us from going up to 64:

	* azurerm_public_ip.test: Error Creating/Updating Public IP "acctestpublicip-8947372815409960058" (Resource Group "acctestRG-8947372815409960058"): network.PublicIPAddressesClient#CreateOrUpdate: Failure sending request: StatusCode=0 -- Original Error: autorest/azure: Service returned an error. Status=400 Code="InvalidDomainNameLabel" Message="The domain name label 12345678-1-2345678-2-2345678-3-2345678-4-2345678-5-2345678-6-2 is invalid. It must conform to the following regular expression: ^[a-z][a-z0-9-]{1,61}[a-z0-9]$." Details=[]

@katbyte katbyte added this to the 1.17.1 milestone Oct 20, 2018
@tombuildsstuff
Copy link
Contributor

tombuildsstuff commented Nov 2, 2018

hi @peterb154

Just to let you know that this has been released as a part of v1.18 of the AzureRM Provider (the full changelog is available here). You can upgrade to this by specifying the version in the provider block (as shown below) and then running terraform init -upgrade

provider "azurerm" {
  version = "=1.18.0"
}

Thanks!

@peterb154
Copy link
Author

peterb154 commented Nov 2, 2018 via email

@ghost
Copy link

ghost commented Mar 6, 2019

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks!

@ghost ghost locked and limited conversation to collaborators Mar 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants