I have the following code which includes two templates
{{- $tests:= list "foo" "bar" }}
{{- range $test := $tests}}
{{- $context := dict "Test" $test "Values" $.Values "Global" $ }}
{{- include "template.works" $context | nindent 4 }}
{{- include "template.does.not-work" $context | nindent 4 }}
{{- end }}
and the templates are
{{- define "template.works" -}}
- name: name-{{ .test}}
{{- end}}
and
{{- define "template.does.not-work" -}}
{{- range $i, $deploy := .Values.deployments }}
- name: name-{{ $deploy.revision }}-{{ .test}}
{{- end}
{{- end}
the template.works is fine the test value is populated.
But it is not populated in template.does.not-work .
The problem is related to the range. If I removed it everything is fine.
What am I doing wrong here?
Does the range overwrites the values that I defined in the context? And how can I address that?