Open thorduri opened 9 years ago
Just ran into this on a project -- seems like this is still an issue and Terraform doesn't notice?
This issue was about the first generation of HCL, which Terraform hasn't used since Terraform v0.12.
Terraform uses HCL 2, though I'm not really sure how best to translate this issue's situation into HCL 2 terms because HCL 2 has a pretty different design where the source of the problem here could correspond with a few different possible behaviors in HCL 2. If you are seeing something that seems incorrect in Terraform then I would suggest opening an issue in the Terraform repository first, and then the Terraform team will debug and figure out if it's a HCL problem and address it upstream if so.
First off, I'm unsure if this is the expected behaviour or not.
When decoding maps it's currently not possible to detect duplicates, as HCL will overwrite (last one wins) the map key.
The HCL fix should be pretty easy, i.e. stick something like the following into decodeMap() right before setting the value on the map:
See for example: https://github.com/hashicorp/consul/pull/1055 or generally any HCL file for that matter:
Could lead to interesting gotchas when depending on the defaults.
I have a patch + tests for HCL, but this probably will bubble up to HCL users that will need munging since this changes behaviour somewhat and I do not know how to best (or even if) handle that.