-
Notifications
You must be signed in to change notification settings - Fork 9.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
0.12upgrade cannot parse heredoc when final EOF
is inline
#20271
Comments
I believe hashicorp/hcl#245 is the change that altered the behavior here. I'm hoping if we roll back as @mildwonkey suggested then the upgrade tool should be bug-compatible with 0.11's HCL parsing due to using the exact same parser. |
This was fixed as part of #20281. |
I upgraded to Terrafrom 0.12 and now terraform reports that all my AWS instance's The hashsum change is caused by missing whitespace in 0.12 and originates from a different interpretation of the final EOF/EOT token. I have the following user data in my terraform template:
Please pay attention to the four spaces before the final EOF terminator and note that there is no terminating line break in the last line, since the EOF token immediately follows the whitespace. The user data as it currently appears in the instance (created with Terraform 0.11) looks like this:
Again, observe that there are four spaces of whitespace in the last line. This results in the sha1 hashsum of Now, with Terraform 0.12, I get a different hashsum:
In the last line the four spaces are missing. Could someone from the Terraform team clarify, if it is possible to achieve the 0.11 behaviour in 0.12? Is it possible to get trailing whitespace in the result, if the final EOF/EOT token has whitespace in front of it. Should #20281 have restored that as well or am I seeing a different issue? |
@lanoxx I'm still seeing the behavior outlined in the issue as well on @apparentlymart I'm still seeing |
As a workaround, you can move the data into a |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
Terraform 0.11 allowed for this syntax (though the documentation specifically requires the terminating EOF to be on a new line):
The 0.12upgrade tool does not care for this:
terraform init also dislikes this syntax:
(capturing slack context)
It was suggested that this was allowed due to a bug in HCL that was fixed - 0.11 vendors an older version of HCL, 0.12 may need to be rolled back to the same version: hashicorp/hcl@13daa63
The text was updated successfully, but these errors were encountered: