I am etting weird YAML indentation with some conditional stuff, effectively I'm doing:

{{ toYaml .Values.resources | indent 10 }}
{{- if .Values.filebeat.enabled -}}
      - name: elastic-logger

But the final line is indented by 10, not 8 as it should be. in fact I can indent it by 0, 10, 100 - but it's always indented 10. any ideas? (edited) .Values.resources is for one container, and if filebeat.enabled then I'm adding another container to the array output:

    - name: elastic-logger

1 Answer 1


Turns out -}} is a special syntax which says 'eat up any following whitespace'. Removing the - fixed this.

I get a blank line, but don't really care, considering!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.