terraform-linters / tflint

A Pluggable Terraform Linter
Mozilla Public License 2.0
4.96k stars 357 forks source link

`tflint --langserver` fails to start, complains about exec format error in google ruleset #1858

Closed ianchesal closed 1 year ago

ianchesal commented 1 year ago

Summary

Trying to use the language server integration for tflint along with the tflint-ruleset-google ruleset `v0.25.0.

Running the linter, standalone, with this ruleset and configuration works fine. But starting it in LSP mode has it fail with:

> /Users/ianchesal/.local/share/nvim/mason/bin/tflint --langserver
15:27:50 langserver.go:28: Starting language server...
15:27:50 langserver.go:32: Failed to start language server: fork/exec .tflint.d/plugins/github.com/terraform-linters/tflint-ruleset-google/0.25.0/tflint-ruleset-google: exec format error

I'm using tflin version:

> /Users/ianchesal/.local/share/nvim/mason/bin/tflint --version
TFLint version 0.48.0

And it's been installed via Mason in my NeoVIM environment. Mason is starting the server like so:

 Config: tflint
    filetypes:         terraform
    root directory:    /Users/ianchesal/src/infrastructure
    cmd:               /Users/ianchesal/.local/share/nvim/mason/bin/tflint --langserver
    cmd is executable: true
    autostart:         true
    custom handlers:   

Note: if I get rid of of my.tflint.hcl file, the LSP mode works as expected.

Command

tflint --langserver

Terraform Configuration

N/A -- the server doesn't even start up so there's no Terraform being scanned

TFLint Configuration

config {
  plugin_dir = "./.tflint.d/plugins"
}

plugin "google" {
  enabled = true
  version = "0.25.0"
  source  = "github.com/terraform-linters/tflint-ruleset-google"
}

Output

> TFLINT_LOG=debug /Users/ianchesal/.local/share/nvim/mason/bin/tflint --langserver
15:34:04 option.go:71: [DEBUG] CLI Options
15:34:04 option.go:72: [DEBUG]   Module: false
15:34:04 option.go:73: [DEBUG]   Force: false
15:34:04 option.go:74: [DEBUG]   Format:
15:34:04 option.go:75: [DEBUG]   Varfiles:
15:34:04 option.go:76: [DEBUG]   Variables:
15:34:04 option.go:77: [DEBUG]   EnableRules:
15:34:04 option.go:78: [DEBUG]   DisableRules:
15:34:04 option.go:79: [DEBUG]   Only:
15:34:04 option.go:80: [DEBUG]   EnablePlugins:
15:34:04 option.go:81: [DEBUG]   IgnoreModules:
15:34:04 langserver.go:28: Starting language server...
15:34:04 config.go:137: [INFO] Load config: .tflint.hcl
15:34:04 config.go:269: [DEBUG] Config loaded
15:34:04 config.go:270: [DEBUG]   Module: false
15:34:04 config.go:271: [DEBUG]   ModuleSet: false
15:34:04 config.go:272: [DEBUG]   Force: false
15:34:04 config.go:273: [DEBUG]   ForceSet: false
15:34:04 config.go:274: [DEBUG]   DisabledByDefault: false
15:34:04 config.go:275: [DEBUG]   DisabledByDefaultSet: false
15:34:04 config.go:276: [DEBUG]   PluginDir: ./.tflint.d/plugins
15:34:04 config.go:277: [DEBUG]   PluginDirSet: true
15:34:04 config.go:278: [DEBUG]   Format:
15:34:04 config.go:279: [DEBUG]   FormatSet: false
15:34:04 config.go:280: [DEBUG]   Varfiles:
15:34:04 config.go:281: [DEBUG]   Variables:
15:34:04 config.go:282: [DEBUG]   Only:
15:34:04 config.go:283: [DEBUG]   IgnoreModules:
15:34:04 config.go:287: [DEBUG]   Rules:
15:34:04 config.go:291: [DEBUG]   Plugins:
15:34:04 config.go:293: [DEBUG]     google: enabled=true, version=0.25.0, source=github.com/terraform-linters/tflint-ruleset-google
15:34:04 config.go:320: [INFO] The `terraform` plugin block is not found. Enable the plugin `terraform` automatically
15:34:04 discovery.go:90: [DEBUG] Find plugin path: .tflint.d/plugins/github.com/terraform-linters/tflint-ruleset-google/0.25.0/tflint-ruleset-google
15:34:04 discovery.go:54: [INFO] Plugin `google` found
15:34:04 [DEBUG] go-plugin@v1.4.10/client.go:604: starting plugin: path=.tflint.d/plugins/github.com/terraform-linters/tflint-ruleset-google/0.25.0/tflint-ruleset-google args=[".tflint.d/plugins/github.com/terraform-linters/tflint-ruleset-google/0.25.0/tflint-ruleset-google"]
15:34:04 langserver.go:32: Failed to start language server: fork/exec .tflint.d/plugins/github.com/terraform-linters/tflint-ruleset-google/0.25.0/tflint-ruleset-google: exec format error

TFLint Version

0.48.0

Terraform Version

No response

Operating System

ianchesal commented 1 year ago

And suddenly it's fine. I have no idea why.