-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
hcl2 length() of map issue #10024
Comments
Hi @traceypooh and thanks for raising this issue. I can reproduce this locally but have not been able to figure the cause a the moment, so will label accordingly. |
At first I suspected this was a quoting issue, but it looks like it fails with the same error even without quoting: # map fails
locals {
nports = length({ "a" = "b" })
} # lists work fine
locals {
nports = length(["a", "b"])
} Suspecting that we actually have an "object" here and not a map, I tried using locals {
nports = length(convert({"a" = "b"}, map(string)))
} And that passes validation. One of the libraries we use is a little picky about object vs map but it looks like the documentation could use some improvement as well. I'll open a PR shortly with some doc fixes. |
thanks y'all! |
whoa, @jrasell -- your name kept running through my head and just finally realized where from. levant!! 😍 |
I'm going to lock this issue because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active issues. |
For reporting security vulnerabilities please refer to the website.
If you have a question, prepend your issue with
[question]
or preferably use the nomad mailing list.If filing a bug please include the following:
Nomad version
Nomad v1.0.3
Operating system and Environment details
Mac mini
Issue
job.hcl:34,15-22: Error in function call; Call to function “length” failed: collection must be a list, a map or a tuple.
Reproduction steps
(see also https://discuss.hashicorp.com/t/hcl2-length-of-map-issue/20911/2 )
Job file (if appropriate)
Nomad Client logs (if appropriate)
If possible please post relevant logs in the issue.
Logs and other artifacts may also be sent to: nomad-oss-debug@hashicorp.com
Please link to your Github issue in the email and reference it in the subject
line:
Emails sent to that address are readable by all HashiCorp employees but are not publicly visible.
Nomad Server logs (if appropriate)
The text was updated successfully, but these errors were encountered: