The IDE's Editor window shows error message " expected, got '.'" on the 4th line of the sample ERB fragment above, after this part of the line: provider =. Apparently, removing the wrapping double quotes (which were required by TF v0.11, but which are invalid in TF v0.13) from around the value of the "provider" attribute (changing it from a String literal into an un-quoted Terraform expression) causes parsing problems for the HCL plugin.
In the 'Terraform Config' tab of the IDE's Structure panel, the ERB's structure is incorrectly displayed as:
Note that everything after the first provider attribute is incorrectly indented, and all resources past the first (incorrectly parsed) resource are missing from the structure.
Steps to Reproduce
Please list the steps required to reproduce the issue, for example:
Open a '*.tf.erb' file like the sample above.
Open the 'Terraform Config' tab of the IDE's Structure panel.
Note that changing ERB line 4 (provider = <%= data[:tf_provider] %>.abc-<%= data[:tf_provider_name] %>) to either of the following fixes the Structure panel's hierarchy display, but at the cost of making the ERB generate invalid HCL:
Previously, before migrating our ERBs from generating TF v0.11-compatible HCL to TF v0.13-compatible HCL, the HCL plugin was able to parse the ERBs mostly correctly, even despite the various if/else, each loop, and <%= ... %> expression blocks scattered throughout the ERBs.
After migrating to TF v0.13-compatible HCL, the HCL plugin is nearly useless for working with the migrated ERB files (even though they generate perfectly valid v0.13-compatible HCL). Everything after the first provider attribute in the file is effectively unparsed, and therefore doesn't work properly with the IDE's code folding, syntax highlighting, Structure panel, and other features which are dependent on correct parsing of the file's AST and code structure.
It seems like much of the plugin's regressions in this area are related to the removal of most of the "wrapping" double-quotes around HCL expressions, and the transition of many Interpolated Strings to first-class expressions.
Thank you for opening an issue. In this template paragraph text could be removed, however please retain headers.
Prerequisites
Installation details
Help->About->Copy to Clipboard
)Settings->Plugins
)terraform -v
)intellij-hcl plugin version: 0.7.10
Terraform v0.13.3
RubyMine 2020.2.2 Build #RM-202.7319.53, built on September 14, 2020 Runtime version: 11.0.8+10-b944.31 x86_64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o. macOS 10.15.6 GC: ParNew, ConcurrentMarkSweep Memory: 1654M Cores: 4 Registry: documentation.show.toolbar=true Non-Bundled Plugins: org.intellij.plugins.hcl, name.kropp.intellij.makefile, com.intellij.plugin.adernov.powershell
Terraform Configuration Files
Sample ERB:
Sample HCL generated by the above ERB:
Exception
I didn't see any exceptions logged to the IDE's Event Log.
Expected Behavior
What should have happened?
Actual Behavior
What actually happened?
provider =
. Apparently, removing the wrapping double quotes (which were required by TF v0.11, but which are invalid in TF v0.13) from around the value of the "provider" attribute (changing it from a String literal into an un-quoted Terraform expression) causes parsing problems for the HCL plugin.Note that everything after the first provider attribute is incorrectly indented, and all resources past the first (incorrectly parsed) resource are missing from the structure.
Steps to Reproduce
Please list the steps required to reproduce the issue, for example:
Note that changing ERB line 4 (
provider = <%= data[:tf_provider] %>.abc-<%= data[:tf_provider_name] %>
) to either of the following fixes the Structure panel's hierarchy display, but at the cost of making the ERB generate invalid HCL:provider = "<%= data[:tf_provider] %>.abc-<%= data[:tf_provider_name] %>"
//provider = <%= data[:tf_provider] %>.abc-<%= data[:tf_provider_name] %>
Previously, before migrating our ERBs from generating TF v0.11-compatible HCL to TF v0.13-compatible HCL, the HCL plugin was able to parse the ERBs mostly correctly, even despite the various if/else, each loop, and
<%= ... %>
expression blocks scattered throughout the ERBs.After migrating to TF v0.13-compatible HCL, the HCL plugin is nearly useless for working with the migrated ERB files (even though they generate perfectly valid v0.13-compatible HCL). Everything after the first provider attribute in the file is effectively unparsed, and therefore doesn't work properly with the IDE's code folding, syntax highlighting, Structure panel, and other features which are dependent on correct parsing of the file's AST and code structure.
It seems like much of the plugin's regressions in this area are related to the removal of most of the "wrapping" double-quotes around HCL expressions, and the transition of many Interpolated Strings to first-class expressions.