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.)
When giving a non-primitive value as a key in an object constructor expression, an error is returned as expected:
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.)