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

<p>I get a blank line, but don't really care, considering!</p>

CC BY-SA 4.0
2018-07-06T17:19:43.103Z
2018-07-06T17:19:43.103Z
Kieren Johnstone
<p>I am etting weird YAML indentation with some conditional stuff, effectively I'm doing:</p>

<pre><code>resources:
{{ toYaml .Values.resources | indent 10 }}
{{- if .Values.filebeat.enabled -}}
      - name: elastic-logger
</code></pre>

<p>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)
<code>.Values.resources</code> is for one container, and if <code>filebeat.enabled</code> then I'm adding another container to the array
output:</p>

<pre><code> resources:
 {}
    - name: elastic-logger
</code></pre>

<yaml><helm>
Helm/ YAML indentation issue
Kieren Johnstone
# Helm/ YAML indentation issue

(Asked by: username_0 on 2018-07-06)

I am etting weird YAML indentation with some conditional stuff, effectively I'm doing:
resources:
{{ 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:
 resources:
 {}
    - name: elastic-logger

**Tags:** yaml, helm


---

## 1 answers

### Answer by username_0 on 2018-07-06. Score: 1 | Accepted answer

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!


---

