cloudposse / terraform-provider-utils

The Cloud Posse Terraform Provider for various utilities (e.g. deep merging, stack configuration management)
https://cloudposse.com/accelerate
Apache License 2.0
96 stars 15 forks source link

deep_copy_list working incorrectly #403

Open md2k opened 2 months ago

md2k commented 2 months ago

Describe the Bug

Option deep_copy_list working incorrectly with utils_deep_merge_yaml (not checked utils_deep_merge_json , but probably same).

deep merge configured with : append_list = false , deep_copy_list = true Input of 2 yaml:

---
test:
  my_list:
     - item1
     - item2
---
test:
  my_list:
     - item1
     - item3
     - item4

Getting as result:

---
test:
  my_list:
     - item1
     - item2

so 2nd Yaml list ignored. In version 1.23 if append_list and deep_copy_list both enabled, result as above, in versions below 1.23 result will be as expected, but probably because append_list in actions.

Expected Behavior

---
test:
  my_list:
     - item1
     - item2
     - item3
     - item4

Steps to Reproduce

Merge any yaml (even from example) with utils_deep_merge_yaml and deep_copy_list enabled

Screenshots

No response

Environment

OS [Mac M3, Mac Intel, Linux], module version 1.23, 1.22, 1.21, 1.20, 1.19, 1.18

Additional Context

Need to merge complex yaml files, with lists in them, in multiple cases it is required to have merge of lists and ensure we not have duplicates in final outputs, so for that we trying to use deep_copy_list , but seems doesn't work.