I am seeing behavior from Chef Client 12 that looks like it’s explained by Chef’s “deep merge” behavior. Is there a way to turn this behavior off so I can reset a certain array-valued node attribute cleanly in a recipe, when it’s set at the same level of precedence in the environment?
I have an array attribute value defined in the Chef environment at the “default” level of precedence. In my cookbook recipe I try to “reset” that attribute to another array value, also at the “default” level of precedence. But at run time Chef ends up using BOTH the values from the Chef environment and the values I specify in the cookbook recipe – it merges both arrays into a unique, sorted list of values.
This behavior seems to be explained by Chef’s “deep merge” behavior as described on the “About Attributes” page (https://docs.chef.io/attributes.html#about-deep-merge):
The deep merge capabilities of the chef-client allows attributes to be layered across
cookbooks, recipes, roles, and environments … When an attribute value is an array, if the
attribute precedence levels are the same, then that data is merged.
In this specific case I don’t want this behavior: I want to cleanly reset the value of this node attribute at the “default” level of precedence to a given array value that I specify in my cookbook recipe. Is that a tried-and-true way to do this?