title: Identing a map from a yaml template in terraform
body: <p>I am in Terraform 14 and I am trying to add labels to my template file which should generate a YAML:</p>
  <p>Template File:</p>
  <pre><code>labels:
    ${labels}
  </code></pre>
  <p>Code:</p>
  <pre><code>locals {
   labels = merge(
     var.labels,
     map(
      &quot;module&quot;, basename(abspath(path.module)),
      &quot;module_version&quot;, var.module_version
     )
   )
  prometheus_config      = templatefile(&quot;${path.module}/prometheus.tmpl&quot;, {
     labels                 = indent(8, yamlencode(local.labels))
  })
  </code></pre>
  <p>When I try to add the labels indenting with 8 this outputs in the template file causing YAML errors:</p>
  <p>Error Output:</p>
  <pre><code>labels:
    &quot;module&quot;: &quot;my_module&quot;
      &quot;module_version&quot;: &quot;1.0&quot;
  </code></pre>
  <p>As you can see the module_version has indent 8 which is correct but the module line is not indented.</p>
  <p>I tried many things like moving <code>${labels}</code> everywhere in the beginning, with multiple indentations but nothing seems to work.</p>