-
Notifications
You must be signed in to change notification settings - Fork 641
Open
Labels
Description
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:
dupKey := resultMap.MapIndex(key)
if dupKey.IsValid() {
return fmt.Errorf(
"%s: duplicate map key %v", name, key)
}See for example: hashicorp/consul#1055 or generally any HCL file for that matter:
variable "foo" {
description = "foo variable"
default = "bar"
}
...
variable "foo" {
description = "foo variable"
default = "crux"
}
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.
Reactions are currently unavailable