{{- if .Values.config -}}
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ template "opensearch-dashboards.fullname" . }}-config
  labels: {{ include "opensearch-dashboards.labels" . | nindent 4 }}
data:
{{- range $configName, $configYaml := .Values.config }}
  {{ $configName }}: |
  {{- if eq (kindOf $configYaml) "map" }}
    {{- tpl (toYaml $configYaml) $ | nindent 4 }}
  {{- else }}
    {{- tpl $configYaml $ | nindent 4 -}}
  {{- end -}}
{{- end -}}
{{- end -}}
