Skip to content

terraform/hcl: improve options, fix terraform-cli error, add tofu-ls#1321

Open
ppenguin wants to merge 11 commits intoNotAShelf:mainfrom
ppenguin:improve-terraformls
Open

terraform/hcl: improve options, fix terraform-cli error, add tofu-ls#1321
ppenguin wants to merge 11 commits intoNotAShelf:mainfrom
ppenguin:improve-terraformls

Conversation

@ppenguin
Copy link
Contributor

@ppenguin ppenguin commented Jan 7, 2026

  • Add tofu(ls) as free terraform alternative for terraform and hcl
  • Harmonize with other format/LSP implementation (also with conform)
  • Add/fix terraform formatter
  • Add nomad fmt as alternative hcl formatter

Note: for (nomad) hcl tofu/terraform ls are ineffective (don't support e.g. jobspec schema) -> TODO: nomad-lsp (package and add, even though it seems abandoned it's probably better for nomad/hcl)

Sanity Checking

  • I have updated the changelog as per my changes
  • I have tested, and self-reviewed my code
  • My changes fit guidelines found in hacking nvf
  • Style and consistency
    • I ran Alejandra to format my code (nix fmt)
    • My code conforms to the editorconfig configuration of the project
    • My changes are consistent with the rest of the codebase
  • If new changes are particularly complex:
    • My code includes comments in particularly complex areas
    • I have added a section in the manual
    • (For breaking changes) I have included a migration guide
  • Package(s) built:
    • .#nix (default package)
    • .#maximal
    • .#docs-html (manual, must build)
    • .#docs-linkcheck (optional, please build if adding links)
  • Tested on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin

Add a 👍 reaction to pull requests you find important.

…(free) as alternative option

- Add tofu(ls) as free terraform alternative for terraform and hcl
- Harmonize with other format/LSP implementation (also with conform)
- Add/fix terraform formatter
- Add `nomad fmt` as alternative hcl formatter

Note: for (nomad) hcl tofu/terraform ls are ineffective (don't support
e.g. jobspec schema) -> TODO: nomad-lsp (package and add, even though it
seems abandoned it's probably better for nomad/hcl)
@github-actions
Copy link

github-actions bot commented Jan 7, 2026

🚀 Live preview deployed from c07410f

View it here:

Debug Information

Triggered by: ppenguin

HEAD at: improve-terraformls

Reruns: 2196

github-actions bot pushed a commit that referenced this pull request Jan 8, 2026
Copy link

@sjcobb2022 sjcobb2022 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall other than a few comments.

In addition, if a user enables both HCL and terraform modules, the lsp configs may overwrite each other.

I know you have tried to combat this by using mkDefault, but I think a more reasonable solution may be to "tag" the LSPs with something like: terraformls-hcl, or opentofu-tf, this way we can have the configs fully separate.

Alternatively, if the configs are identical other than the filetypes, then there is no need to use mkDefault as nix should merge the two arrays anyway.

github-actions bot pushed a commit that referenced this pull request Jan 9, 2026
github-actions bot pushed a commit that referenced this pull request Jan 9, 2026
@ppenguin ppenguin force-pushed the improve-terraformls branch from bdfa328 to 02369b0 Compare January 9, 2026 09:25
github-actions bot pushed a commit that referenced this pull request Jan 9, 2026
@sjcobb2022
Copy link

Would definitely want @NotAShelf and @horriblename to take a look at this impl

@ppenguin
Copy link
Contributor Author

@NotAShelf BTW, there seems to be a regression on main (introduced sometime since 7 days ago), that breaks nix build .#docs-html:

error: Cannot build '/nix/store/ar4ndivdlidqp8glnbvag5fq2hvxsjdz-nvf-docs-html.drv'.
       Reason: builder failed with exit code 1.
       Output paths:
         /nix/store/3ixr2az6w2dqxzz745qn1zsxjz86gmmg-nvf-docs-html
...
       > Error:
       >    0: Configuration error: No config file provided. Use --config-file to specify a config file.
       >
       > Location:
       >    ndg/src/main.rs:106

This affected this issue as well since I did a rebase.

@NotAShelf
Copy link
Owner

Ah damn I forgot to test the config module before NDG's 2.6.0 refactor. I'll try to take a look today after work or tomorrow during the day.

github-actions bot pushed a commit that referenced this pull request Jan 24, 2026
github-actions bot pushed a commit that referenced this pull request Feb 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants