Hey, I'm looking into this <https://atmos.tools/fu...
# atmos
l
Hey, I'm looking into this https://atmos.tools/functions/yaml/template#advanced-examples Seems like if I have one file that defines a value using this pattern
Copy code
# catalog/blob/defaults

components:
  terraform:
    blob:
      metadata:
        component: blob
      vars:
        foo: !template "{{ toJson .settings.bar }}" # this parses to a list
and another that imports this and tries to merge the value (or override in this case with list overwrite)
Copy code
import:
  - catalog/blob/defaults

components:
  terraform:
    blob:
      metadata:
        component: blob
      vars:
        foo: []
I get an error like this
Error: merge error: mergo merge failed: cannot override two slices with different type ([]interface {}, string)
Am I doing something wrong here ?
If I change the value( i.e. settings.foo = {"b" :2}) to a map and change the importing file to this
Copy code
import:
  - catalog/blob/defaults

components:
  terraform:
    blob:
      metadata:
        component: blob
      vars:
        foo: {"a":1}
It seems to work fine though, so maybe just a problem with lists ?
a
if you comment out
foo: []
and execute
atmos describe component blob -s <stack>
, what value do you see in
vars.foo
?
l
Copy code
foo:
    - 1
    - 2
    - 3
actually the object doesn't seem to merge properly, it just overwrites. i.e. I would expect output
foo : {"a":1, "b":2}
But I get just
Copy code
foo:
    a: 1
or (if I comment out in the file that imports)
Copy code
foo:
    b: 2
a
interesting... that should work can you please send me your full config (the two files should be enough), I'll create a test for it (you can DM me)
👍 1