Terraform: invalid characters in heredoc anchor
<p>I am trying to use a multiline string in the <code>provisioner "remote-exec"</code> block of my terraform script.  Yet whenever I use the <code>EOT</code> syntax as outlined in the documentation and various examples I get an error that complains about having: <code>invalid characters in heredoc anchor</code>.</p>

<p>Here is an example of a simple <code>provisioner "remote-exec"</code> that received this error (both types of EOT receive this error when attempted separately):</p>

<pre><code>provisioner "remote-exec" {
  inline = [
    &lt;&lt; EOT 
    echo hi 
    EOT,

    &lt;&lt; EOT 
    echo \
    hi 
    EOT,
  ]
}
</code></pre>

<p><strong>Update:</strong> Here is the working solution, read carefully if you are having this issue because terraform is very picky when it comes to EOF:</p>

<pre><code>provisioner "remote-exec" {
  inline = [&lt;&lt;EOF

   echo foo
   echo bar

  EOF
  ]
}
</code></pre>

<p>Note that if you want to use EOF all the commands you use in a <code>provisioner "remote-exec"</code> block must be inside the EOF.  You cannot have both EOF and non EOF its one or the other.</p>

<p>The first line of EOF must begin like this, and you cannot have any whitespace in this line after <code>&lt;&lt;EOF</code> or else it will complain about having <code>invalid characters in heredoc anchor</code>:</p>

<pre><code>  inline = [&lt;&lt;EOF
</code></pre>

<p>Your EOF must then end like this with the <code>EOF</code> at the same indentation as the <code>]</code></p>

<pre><code>  EOF
  ]
</code></pre>