-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Virtual network empty string in DNS Servers crashes terraform #2010
Comments
My understanding is when terraform reads the dns_servers attribute from the resource,
Proposed Solutionmaster...tlcowling:dnsserverbug I tried adding a validation function to dns_servers in the resource to catch this case and give a useful error. That would have helped me when I accidentally added an empty variable
For now I’m just guarding against empty strings which cause terraform to crash. Validation of the DNS server is done by the Azure API where an invalid entry ends up throwing an error on apply like this:
Do you think its worth adding more validation to the DNS Server entries? A more thorough DNS validation for example... I think theres value in getting feedback in a plan before an apply |
Thanks @tlcowling for reporting the issue. And your proposal is correct, I have created a PR (#2305) to make sure they are not empty strings. For now, I will just fix the crash here. Of course we can do a more sophisticated validation (for example, resource name validation, IPv4 and IPv6 validations). But let's keep it as a TODO item. |
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! |
Community Note
I came across a Terraform crash when accidentally passing a variable containing an empty string to a list of DNS servers in the azurerm_virtual_network resource:
Terraform Version
Terraform v0.11.8
Affected Resource(s)
Terraform Configuration Files
Panic Output
Expected Behavior
An indication that the input is invalid instead of a terraform crash on apply. Maybe there could be a validation message at the plan stage?
Actual Behavior
Terraform crash
Steps to Reproduce
terraform apply
(against above config example)The text was updated successfully, but these errors were encountered: