-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Allow disabling hcl2 interpolation for string literals #10777
Comments
Support the new post-1.0.0 job spec fields in the HCLv1 parser. The HCLv1 parser is still the default (or only!) parser in many downstream tools, e.g. [Levant](https://github.com/hashicorp/levant/blob/e48c439f14def83b0cbe24c2553e90e959474f16/template/render.go#L13-L30), and [terraform-provider-nomad](https://github.com/hashicorp/terraform-provider-nomad/blob/bce32a783176c7943ac662a3eee48b76d92c4d6a/nomad/resource_job.go#L735-L743) . While we initially intended to deprecate HCLv1 parser in 1.0.0, we never communicated that publicly. We did not fully anticipate the public usage of `jobspec` package (we assumed it's a private package), or the friction that HCLv2 introduced in some cases (e.g. #10777, #9838). So moving forward we intend to ensure that new job spec fields are honored in both the HCLv1 and HCLv2 parser until we solidify the migration path and communicate it properly.
@notnoop - just wanted to follow up if there had been any further movement on this? We're still stuck on HCL1 jobs and getting deeper and deeper in to having a hard time switching to HCL2 without this kind of feature Thanks! |
I'm going to close this issue as a duplicate of #9838. I've left some notes there recently on the challenge involved in implementing this, which will likely require upstream changes to HCL syntax. |
I'm going to lock this issue because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active issues. |
HCLv2 added more comprehensive support for expression interpolation within strings. Users can insert variable references (e.g.
${var.user_field}
) or expressions in here-doc style syntax:This interpolation though comes with downsides. Nomad templates frequently embed shell/perl scripts or embedded nijna-like templates that can conflict with the use of
${
or%{
. Users must escape references of${
and%{
, a tedious task, specially for users upgrading from pre-1.0.0 nomad versions.We should consider adding a mechanism to disable HCLv2 interpolation processing; e.g. adopt the bash heredoc mechanism to disable variables, by using
'
, e.g.<<'EOF'
.The change needs to be coordinated with the hcl library.
This issue was raised in #10743 and #9838 (comment) .
The text was updated successfully, but these errors were encountered: