You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Many snippets from 'terraform.json' do not follow the snippet grammar regarding variables (both upcoming 3.18 version and the current 3.17 version).
It states that variable name should match the following regex: [_a-zA-Z][_a-zA-Z0-9]*. The 'terraform.json' file contains a lot of instances that use period (.) and/or dash (-) inside variable name. Here are couple of example: one (${path.module}), two (${data.ibm_org.myResourceName-org.id}), three (${var.s3_bucket_name}). In total there are at least 90 instances of this currently (at 00ba9dd), some of them mixed with preceding \\ which makes the following $ be not recognized as variable at all (like here).
The text was updated successfully, but these errors were encountered:
At first glance, it seems like the issue is that HCL uses the same syntax for its own variables. In snippet example 'three', the output should contain the literal string ${var.s3_bucket_name} but I guess that throws parsing errors? I've never worked with snippets beyond just using them. I hit a parsing error on this one today which initiated my search to find this issue.
From what I understand based on the snippet grammar documentation, the snippet I'm using is likely failing to parse because of the line " ami_id = \"${var.ami_id}\"",? Since I would want the literal ${var.ami_id} to be contained in the output of the snippet, it should be written instead as " ami_id = \"\${var.ami_id}\"", with the \ in front of the $?
Hopefully my understanding is correct. I'll try and take a stab at it when I can find some spare time this week.
Ah, so are most of the instances of ${var.ami_id} and similar meant to be inserted literally as that text? Sorry, I am completely not familiar with terraform.
If this is correct, then yes, it at least should be represented in Lua as "\\${var.ami_id}" or [[\${var.ami_id}]]. But judging by the grammar in LSP specification the } should also be escaped (so it becomes "\\${var.ami_id\\}"). Not sure if all snippet engines support the latter though.
Many snippets from 'terraform.json' do not follow the snippet grammar regarding variables (both upcoming 3.18 version and the current 3.17 version).
It states that variable name should match the following regex:
[_a-zA-Z][_a-zA-Z0-9]*
. The 'terraform.json' file contains a lot of instances that use period (.
) and/or dash (-
) inside variable name. Here are couple of example: one (${path.module}
), two (${data.ibm_org.myResourceName-org.id}
), three (${var.s3_bucket_name}
). In total there are at least 90 instances of this currently (at 00ba9dd), some of them mixed with preceding\\
which makes the following$
be not recognized as variable at all (like here).The text was updated successfully, but these errors were encountered: