hashicorp / hcl2

Former temporary home for experimental new version of HCL
https://github.com/hashicorp/hcl
Mozilla Public License 2.0
373 stars 66 forks source link

"Incorrect key type" error reports incorrect source location #54

Closed apparentlymart closed 5 years ago

apparentlymart commented 5 years ago

When giving a non-primitive value as a key in an object constructor expression, an error is returned as expected:

Error: Incorrect key type

  on list-as-map-key.tf line 7, in locals:
   7:     "${null_resource.x.*.id}" = {
   8:       username = "foo"
   9:       password = "bar"
  10:     }

Can't use this value as a key: string required.

However, the error message indicates the value expression as the subject of the error, rather than the key expression. (That is, the part on the right hand side of the equals is what is underlined in the rendered message.)