{{ if and (or (.Files.Glob "files/conf/*") .Values.input .Values.filter .Values.output) (not .Values.existingConfiguration) }}
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ include "logstash.fullname" . }}
  labels: {{- include "logstash.labels" . | nindent 4 }}
data:
{{- if (.Files.Glob "files/conf/*") }}
{{ (.Files.Glob "files/conf/*").AsConfig | indent 2 }}
{{- else if (or .Values.input .Values.filter .Values.output) }}
  logstash.conf: |-
{{- if .Values.input }}
    input {
{{ tpl .Values.input $ | indent 6 }}
    }
{{- end }}
{{- if .Values.filter }}
    filter {
{{ tpl .Values.filter $ | indent 6 }}
    }
{{- end }}
{{- if .Values.output }}
    output {
{{ tpl .Values.output $ | indent 6 }}
    }
{{- end }}
{{ end }}
{{ end }}
