Conversation
| }), | ||
| false, | ||
| }, | ||
| { // attr a type and value is overridden |
There was a problem hiding this comment.
^^ I think we should add this (type and value being overridden) as an example to the documentation, what do you think?
There was a problem hiding this comment.
Ah, it looks like this was never documented to work on anything by maps! Hard to roll that back now since users very quickly discovered that arbitrary combinations of objects and maps could be merged.
I guess we need to update the whole doc page on this
mildwonkey
left a comment
There was a problem hiding this comment.
Nice! I think we should add a couple of examples to the documentation - there's a bit in here that might not be intuitive, like overriding an attribute's type - but that's not something to block this PR
This PR implements 2 changes to the merge function. - Rather than always defining the merge return type as dynamic, return a precise type when all argument types match, or all possible object attributes are known. - Always return a value containing all keys when the keys are known. This allows the use of merge output in for_each, even when keys are yet to be determined.
e6e5653 to
47dfb60
Compare
47dfb60 to
529271e
Compare
| `merge` takes an arbitrary number of maps and returns a single map that | ||
| contains a merged set of elements from all of the maps. | ||
| `merge` takes an arbitrary number of maps or objects, and returns a single map | ||
| pr object that contains a merged set of elements from all arguments. |
There was a problem hiding this comment.
Howdy, I was just passing by. Sorry if this is a duplicate:
Watch out pr object I think you meant or object
There was a problem hiding this comment.
Thanks, totally missed that
|
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
This PR implements 2 changes to the merge function.
a precise type when all argument types match, or all possible object
attributes are known.
This allows the use of merge output in for_each, even when keys are yet
to be determined.
Fixes #24024
This also handles the bulk of the concerns from #23052 and comments in #22735. While those had other confounding factors that led us astray, the common thread is that users expect
mergeto return what known keys it has, which is what a for expression would be able to do.