terraform-linters / tflint

A Pluggable Terraform Linter

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Failed to initialize plugins

shanelanan opened this issue · comments

Summary

When running tflint --recursive , I am unable to initialize the plugins.

What I tried:
Install as as root user and call tflint --init as root
Install as root and call tflint --init, then switch to jenkins user and call tflint --init again.

Both --init calls work fine, the plugins are there. However, when I switch to jenkins user to run my pipeline, I get the error message about failed to initialize.

Any guidance about which permissions to open up to fix this would be much appreciated. I already have the /usr/local/bin/tflint on permissions 777.

Command

tflint --recursive --force

Terraform Configuration

N/A

TFLint Configuration

plugin "terraform" {
  enabled = true
  preset  = "recommended"

  version = "0.4.0"
  source  = "github.com/terraform-linters/tflint-ruleset-terraform"
}

plugin "aws" {
  enabled = true

  version = "0.25.0"
  source  = "github.com/terraform-linters/tflint-ruleset-aws"
}

Output

16:34:24  20:34:24 config.go:137: [INFO] Load config: .tflint.hcl
16:34:24  20:34:24 config.go:269: [DEBUG] Config loaded
16:34:24  20:34:24 config.go:270: [DEBUG]   Module: false
16:34:24  20:34:24 config.go:271: [DEBUG]   ModuleSet: false
16:34:24  20:34:24 config.go:272: [DEBUG]   Force: false
16:34:24  20:34:24 config.go:273: [DEBUG]   ForceSet: false
16:34:24  20:34:24 config.go:274: [DEBUG]   DisabledByDefault: false
16:34:24  20:34:24 config.go:275: [DEBUG]   DisabledByDefaultSet: false
16:34:24  20:34:24 config.go:276: [DEBUG]   PluginDir: 
16:34:24  20:34:24 config.go:277: [DEBUG]   PluginDirSet: false
16:34:24  20:34:24 config.go:278: [DEBUG]   Format: 
16:34:24  20:34:24 config.go:279: [DEBUG]   FormatSet: false
16:34:24  20:34:24 config.go:280: [DEBUG]   Varfiles: 
16:34:24  20:34:24 config.go:281: [DEBUG]   Variables: 
16:34:24  20:34:24 config.go:282: [DEBUG]   Only: 
16:34:24  20:34:24 config.go:283: [DEBUG]   IgnoreModules:
16:34:24  20:34:24 config.go:287: [DEBUG]   Rules:
16:34:24  20:34:24 config.go:291: [DEBUG]   Plugins:
16:34:24  20:34:24 config.go:293: [DEBUG]     terraform: enabled=true, version=0.4.0, source=github.com/terraform-linters/tflint-ruleset-terraform
16:34:24  20:34:24 config.go:293: [DEBUG]     aws: enabled=true, version=0.25.0, source=github.com/terraform-linters/tflint-ruleset-aws
16:34:24  20:34:24 option.go:71: [DEBUG] CLI Options
16:34:24  20:34:24 option.go:72: [DEBUG]   Module: false
16:34:24  20:34:24 option.go:73: [DEBUG]   Force: true
16:34:24  20:34:24 option.go:74: [DEBUG]   Format: 
16:34:24  20:34:24 option.go:75: [DEBUG]   Varfiles: 
16:34:24  20:34:24 option.go:76: [DEBUG]   Variables: 
16:34:24  20:34:24 option.go:77: [DEBUG]   EnableRules: 
16:34:24  20:34:24 option.go:78: [DEBUG]   DisableRules: 
16:34:24  20:34:24 option.go:79: [DEBUG]   Only: 
16:34:24  20:34:24 option.go:80: [DEBUG]   EnablePlugins: 
16:34:24  20:34:24 option.go:81: [DEBUG]   IgnoreModules:
16:34:24  20:34:24 loader.go:38: [INFO] Initialize new loader
16:34:24  20:34:24 config.go:137: [INFO] Load config: .tflint.hcl
16:34:24  20:34:24 config.go:147: [INFO] file not found
16:34:24  20:34:24 config.go:155: [INFO] Load config: /home/jenkins/agent/workspace/es_default_feature-EnableTflint2/plz-out/tmp/phase-lint-rule._build/.tflint.hcl
16:34:24  20:34:24 config.go:163: [INFO] file not found
16:34:24  20:34:24 config.go:165: [INFO] Use default config
16:34:24  20:34:24 config.go:320: [INFO] The `terraform` plugin block is not found. Enable the plugin `terraform` automatically
16:34:24  20:34:24 option.go:71: [DEBUG] CLI Options
16:34:24  20:34:24 option.go:72: [DEBUG]   Module: false
16:34:24  20:34:24 option.go:73: [DEBUG]   Force: true
16:34:24  20:34:24 option.go:74: [DEBUG]   Format: 
16:34:24  20:34:24 option.go:75: [DEBUG]   Varfiles: 
16:34:24  20:34:24 option.go:76: [DEBUG]   Variables: 
16:34:24  20:34:24 option.go:77: [DEBUG]   EnableRules: 
16:34:24  20:34:24 option.go:78: [DEBUG]   DisableRules: 
16:34:24  20:34:24 option.go:79: [DEBUG]   Only: 
16:34:24  20:34:24 option.go:80: [DEBUG]   EnablePlugins: 
16:34:24  20:34:24 option.go:81: [DEBUG]   IgnoreModules:
16:34:24  20:34:24 loader.go:38: [INFO] Initialize new loader
16:34:24  20:34:24 loader.go:83: [INFO] Module inspection is disabled. Building the root module without children...
16:34:24  20:34:24 runner.go:46: [INFO] Initialize new runner for root
16:34:24  20:34:24 discovery.go:33: [INFO] Plugin `terraform` is not installed, but the bundled plugin is available.
16:34:24  20:34:24 discovery.go:54: [INFO] Plugin `terraform` found
16:34:24  20:34:24 [DEBUG] go-plugin@v1.4.10/client.go:604: starting plugin: path=/usr/local/bin/tflint args=["/usr/local/bin/tflint", "--act-as-bundled-plugin"]
16:34:24  20:34:24 [DEBUG] go-plugin@v1.4.10/client.go:612: plugin started: path=/usr/local/bin/tflint pid=343
16:34:24  20:34:24 [DEBUG] go-plugin@v1.4.10/client.go:707: waiting for RPC address: path=/usr/local/bin/tflint
16:34:24  20:34:24 [DEBUG] go-plugin@v1.4.10/client.go:1046: tflint: 20:34:24 [ERROR] go-plugin@v1.4.10/server.go:278: plugin init error: error="listen unix /home/jenkins/agent/workspace/es_default_feature-SOME_FEATURE_BRANCH/plz-out/tmp/phase-lint-rule._build/plugin620927320: bind: invalid argument"
16:34:24  20:34:24 [INFO]  go-plugin@v1.4.10/client.go:665: plugin process exited: path=/usr/local/bin/tflint pid=343
16:34:24  Failed to initialize plugins; Unrecognized remote plugin message: 
16:34:24  This usually means
16:34:24    the plugin was not compiled for this architecture,
16:34:24    the plugin is missing dynamic-link libraries necessary to run,
16:34:24    the plugin is not executable by this process due to file permissions, or
16:34:24    the plugin failed to negotiate the initial go-plugin protocol handshake
16:34:24  
16:34:24  Additional notes about plugin:
16:34:24    Path: /usr/local/bin/tflint
16:34:24    Mode: -rwxrwxrwx
16:34:24    Owner: 0 [root] (current: 1011260000 [jenkins])
16:34:24    Group: 0 [root] (current: 0 [root])
16:34:24    ELF architecture: EM_X86_64 (current architecture: amd64)

TFLint Version

0.47.0

Terraform Version

1.5.2

Operating System

  • Linux
  • macOS
  • Windows