I am using helmfile for my helm releases.
I have a yaml file projects.yaml
# projects.yaml
- yako
- pera
- okta
In values.yaml.gotmpl, i want to iterate thru the content of projects.yaml :
# values.yaml.gotmpl
{{ $projects := readFile 'projects.yaml' }}
{{ range $_, $project := $projects }}
# do something with $project . e.g: tpl (readFile 'proj-config.yaml') (dict $name $project)
{{ end}}
Unfortunately , i got this error :
failed to render [values.yaml.gotmpl], because of template: stringTemplate:60:41:
executing "stringTemplate" at <$projects>: range can't iterate over projects:
- yako
- pera
- okta
I made a lot of blind attempts to make it work :
{{ range $_, $project := $projects | fromYaml }}
{{ range $_, $project := $projects | toYaml }}
{{ range $_, $project := $projects | list }}
No way