amplify-education / python-hcl2

MIT License
236 stars 52 forks source link

RuntimeError: Invalid Heredoc token: <<EOF_CONFIG #7

Closed dekimsey closed 4 years ago

dekimsey commented 4 years ago

Terraform docs state:

The << marker followed by any identifier at the end of a line introduces the sequence. Terraform then processes the following lines until it finds one that consists entirely of the identifier given in the introducer. In the above example, EOT is the identifier selected. Any identifier is allowed, but conventionally this identifier is in all-uppercase and begins with EO, meaning "end of". EOT in this case stands for "end of text".

Looking at the regex in transformer.py it seems to be missing _ and possibly -. I don't have any examples of terraform code where we used a hyphen, but that is normally a valid identifier for resources. The heredoc token can definitely be prepended with a - to indicate whitespace dedent-ing should occur.

aoskotsky-amplify commented 4 years ago

Good catch. This PR should fix it https://github.com/amplify-education/python-hcl2/pull/9