Helm newbie here. I am trying to loop through files and create a configmap with its contents. The file contents need to have variable defined inside the loop. Below is the configmap I am working with.
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "proj.name" . }}
labels:
app.kubernetes.io/name: {{ include "proj.name" . }}
app.kubernetes.io/version: {{ include "proj.version" . }}
data:
{{- range $path, $_ := .Files.Glob "myconfig/*.txt" -}}
{{ $path | base | nindent 2 }}: |
{{- tpl ($.Files.Get $path) $ | nindent 4 }}
{{- end -}}
contents of myconfig/name.txt
i am able to access this -> {{ .Values.somekey }}
But not this -> {{ $path }}
I get error: undefined variable "$path" Any help would be greatly appreciated. Thank you.