terramate-io / terramate

Terramate CLI is an open-source Infrastructure as Code (IaC) Orchestration and Code Generation tool for Terraform, OpenTofu and Terragrunt.
https://terramate.io
Mozilla Public License 2.0
3.12k stars 86 forks source link

[FEATURE] Support Terraform auto-complete in generate_hcl blocks in VS Code #1650

Open cwe1ss opened 2 months ago

cwe1ss commented 2 months ago

Is your feature request related to a problem? Please describe. In many of my stacks, I'm calling just one Terraform module with some of the values coming from Terramate globals.

If I define my module call in a main.tf, I will get Terraform auto-complete (which I really need for usability), but I will have to convert my Terramate globals into Terraform locals (via some generate_hcl block). This seems like a redundant step.

If I define my module call directly in my stack.tm.hcl through a generate_hcl-block, I can access all my Terramate globals (which is great), but I don't have any auto-complete for the Terraform module, so I constantly have to look at the module documentation, or call terramate generate and look at the generated code.

Describe the solution you'd like The Terramate VS Code extension supports Terraform auto-completion in generate_hcl-blocks. It could look at the extension of the generated file name and somehow redirect the content block to its original VS Code extension for auto-complete.

Ideally, this would also support auto-complete for the Terramate globals. :)

image

Additional context Maybe possible using the Embedded Languages-features of VS Code!?

soerenmartius commented 2 months ago

Great suggestion! Thanks! @i4ki this one is for you :)

ImIOImI commented 1 month ago

This would dramatically increase the DX for code generation.

anemiroffsumer commented 1 month ago

This is vital