0

I have the following values.yaml

documentStorage:
  folders:
    TEST1:
      permissions:
        read: "test1@email.com"
        write: "test1@email.com"
    TEST2:
      permissions:
       read: "test2@email.com"
       write: "test2@email.com"

And, I want to move that to my config map, but, since the keys under folder can be extended, I would like to use the range functionality. And also, I would like to copy the exact structure under it, if possible:

documentStorage:
  folders:
    {{- range $folder, $structure := .Values.global.documentStorage.folders }}
      {{ $folder }}: {{ $structure }}
    {{- end}}

But, it isn't working, and I get this:

folders:
  TEST1:
    permissions: map[read:test1@email.com write:test1@email.com]
  TEST2:
    permissions: map[read:test2@email.com write:test2@email.com]

What am I missing?

Manuelarte
  • 1,658
  • 2
  • 28
  • 47

1 Answers1

2

Use the following snippet. You'd need to change the value of indent depending on what nesting level you are setting documentStorage at

  documentStorage:
    folders:
{{ .Values.documentStorage.folders | toYaml | indent 6 }}
mukesh
  • 726
  • 1
  • 11
  • 27