I have two documents:
---
resources:
- index: 1
- index: 2
and
resources:
- index: 2
- index: 3
- index: 4
My desired output is:
resources:
- index: 1
- index: 2
- index: 3
- index: 4
I tried
#@ load("@ytt:overlay", "overlay")
#@ load("@ytt:data", "data")
#@overlay/match by=overlay.all, expects="1+"
---
resources:
#@overlay/match by=lambda idx,left,right: data.values.left[idx]==data.values.right[idx], missing_ok=True
#@overlay/replace
- index: 1
- index: 2
#@ load("@ytt:overlay", "overlay")
#@ load("@ytt:data", "data")
#@overlay/match by=overlay.all, expects="1+"
---
resources:
#@overlay/match by=lambda idx,left,right: data.values.left[idx]==data.values.right[idx], missing_ok=True
#@overlay/replace
- index: 2
- index: 3
- index: 3
This does not work. How do I use the array values to make ytt match by logic?