Skip to content

Race condition on circular dependency check when using parallel workers #2094

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
1 of 3 tasks
stephanschielke opened this issue Aug 6, 2024 · 3 comments · Fixed by #2096
Closed
1 of 3 tasks

Race condition on circular dependency check when using parallel workers #2094

stephanschielke opened this issue Aug 6, 2024 · 3 comments · Fixed by #2096
Labels

Comments

@stephanschielke
Copy link

Summary

I sporadically receive (false) tflint "circular reference found" errors.
I believe it might be some sort of race condition when multiple parallel workers are being used.
The linting error does not occur when the flag --no-parallel-runners is being passed.

Here is a quick way to demonstrate the sporadic nature of the issue:

while [ true ]; do tflint --recursive --config "$(pwd)/.tflint.hcl" && echo "Status code was: $?"; done
│ Failed to run in google; exit status 1

Failed to check ruleset; google/main.tf:20,13-29: circular reference found; local.project_id -> local.project_id

│ Failed to run in google; exit status 1

Failed to check ruleset; google/main.tf:20,13-29: circular reference found; local.project_id -> local.project_id

Status code was: 0
Status code was: 0
│ Failed to run in google; exit status 1

Failed to check ruleset; google/main.tf:20,13-29: circular reference found; local.project_id -> local.project_id

while [ true ]; do tflint --recursive --config "$(pwd)/.tflint.hcl" --no-parallel-runners && echo "Status code was: $?"; done
Status code was: 0
Status code was: 0
Status code was: 0
Status code was: 0
Status code was: 0
Status code was: 0

My main.tf looks like this:

terraform {
  required_version = "1.9.3"

  backend "gcs" {
    bucket = "bucket_name"
    prefix = "terraform/state"
  }

  required_providers {
    google = {
      source  = "hashicorp/google"
      version = "5.39.1"
    }
  }
}

provider "google" {
  project = local.project_id
  region  = "us-central1"
}

The local is stored in a variables.tf file:

locals {
  project_id = "project_id"
}

Here are my rulesets and tflint version:

tflint --version                                
TFLint version 0.52.0
+ ruleset.terraform (0.8.0-bundled)
+ ruleset.google (0.30.0)

Command

tflint --recursive --config "$(pwd)/.tflint.hcl"

Terraform Configuration

terraform {
  required_version = "1.9.3"

  backend "gcs" {
    bucket = "bucket_name"
    prefix = "terraform/state"
  }

  required_providers {
    google = {
      source  = "hashicorp/google"
      version = "5.39.1"
    }
  }
}

TFLint Configuration

tflint {
  required_version = ">= 0.52.0"
}

config {
  format     = "compact"
  plugin_dir = "~/.tflint.d/plugins"

  call_module_type    = "local"
  force               = false
  disabled_by_default = false

  ignore_module = {}

  varfile = []
  variables = []
}

plugin "terraform" {
  enabled = true
  preset  = "all"
}

rule "terraform_required_providers" {
  enabled = false
}

rule "terraform_required_version" {
  enabled = false
}

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

Output

│ An output to stderr found in .

11:43:27 config.go:147: [INFO] Load config: /infrastructure-iac/.tflint.hcl
11:43:27 config.go:347: [DEBUG] Config loaded
11:43:27 config.go:348: [DEBUG]   CallModuleType: local
11:43:27 config.go:349: [DEBUG]   CallModuleTypeSet: true
11:43:27 config.go:350: [DEBUG]   Force: false
11:43:27 config.go:351: [DEBUG]   ForceSet: true
11:43:27 config.go:352: [DEBUG]   DisabledByDefault: false
11:43:27 config.go:353: [DEBUG]   DisabledByDefaultSet: true
11:43:27 config.go:354: [DEBUG]   PluginDir: ~/.tflint.d/plugins
11:43:27 config.go:355: [DEBUG]   PluginDirSet: true
11:43:27 config.go:356: [DEBUG]   Format: compact
11:43:27 config.go:357: [DEBUG]   FormatSet: true
11:43:27 config.go:358: [DEBUG]   Varfiles: 
11:43:27 config.go:359: [DEBUG]   Variables: 
11:43:27 config.go:360: [DEBUG]   Only: 
11:43:27 config.go:361: [DEBUG]   IgnoreModules:
11:43:27 config.go:365: [DEBUG]   Rules:
11:43:27 config.go:367: [DEBUG]     terraform_required_providers: false
11:43:27 config.go:367: [DEBUG]     terraform_required_version: false
11:43:27 config.go:369: [DEBUG]   Plugins:
11:43:27 config.go:371: [DEBUG]     terraform: enabled=true, version=, source=
11:43:27 config.go:371: [DEBUG]     google: enabled=true, version=0.30.0, source=github.com/terraform-linters/tflint-ruleset-google
11:43:27 option.go:91: [DEBUG] CLI Options
11:43:27 option.go:92: [DEBUG]   CallModuleType: local
11:43:27 option.go:93: [DEBUG]   Force: true
11:43:27 option.go:94: [DEBUG]   Format: 
11:43:27 option.go:95: [DEBUG]   Varfiles: 
11:43:27 option.go:96: [DEBUG]   Variables: 
11:43:27 option.go:97: [DEBUG]   EnableRules: 
11:43:27 option.go:98: [DEBUG]   DisableRules: 
11:43:27 option.go:99: [DEBUG]   Only: 
11:43:27 option.go:100: [DEBUG]   EnablePlugins: 
11:43:27 option.go:101: [DEBUG]   IgnoreModules:
11:43:27 loader.go:39: [INFO] Initialize new loader


│ An output to stderr found in google/modules

11:43:27 config.go:147: [INFO] Load config: /infrastructure-iac/.tflint.hcl
11:43:27 config.go:347: [DEBUG] Config loaded
11:43:27 config.go:348: [DEBUG]   CallModuleType: local
11:43:27 config.go:349: [DEBUG]   CallModuleTypeSet: true
11:43:27 config.go:350: [DEBUG]   Force: false
11:43:27 config.go:351: [DEBUG]   ForceSet: true
11:43:27 config.go:352: [DEBUG]   DisabledByDefault: false
11:43:27 config.go:353: [DEBUG]   DisabledByDefaultSet: true
11:43:27 config.go:354: [DEBUG]   PluginDir: ~/.tflint.d/plugins
11:43:27 config.go:355: [DEBUG]   PluginDirSet: true
11:43:27 config.go:356: [DEBUG]   Format: compact
11:43:27 config.go:357: [DEBUG]   FormatSet: true
11:43:27 config.go:358: [DEBUG]   Varfiles: 
11:43:27 config.go:359: [DEBUG]   Variables: 
11:43:27 config.go:360: [DEBUG]   Only: 
11:43:27 config.go:361: [DEBUG]   IgnoreModules:
11:43:27 config.go:365: [DEBUG]   Rules:
11:43:27 config.go:367: [DEBUG]     terraform_required_providers: false
11:43:27 config.go:367: [DEBUG]     terraform_required_version: false
11:43:27 config.go:369: [DEBUG]   Plugins:
11:43:27 config.go:371: [DEBUG]     terraform: enabled=true, version=, source=
11:43:27 config.go:371: [DEBUG]     google: enabled=true, version=0.30.0, source=github.com/terraform-linters/tflint-ruleset-google
11:43:27 option.go:91: [DEBUG] CLI Options
11:43:27 option.go:92: [DEBUG]   CallModuleType: local
11:43:27 option.go:93: [DEBUG]   Force: true
11:43:27 option.go:94: [DEBUG]   Format: 
11:43:27 option.go:95: [DEBUG]   Varfiles: 
11:43:27 option.go:96: [DEBUG]   Variables: 
11:43:27 option.go:97: [DEBUG]   EnableRules: 
11:43:27 option.go:98: [DEBUG]   DisableRules: 
11:43:27 option.go:99: [DEBUG]   Only: 
11:43:27 option.go:100: [DEBUG]   EnablePlugins: 
11:43:27 option.go:101: [DEBUG]   IgnoreModules:
11:43:27 loader.go:39: [INFO] Initialize new loader


│ An output to stderr found in google/modules/cloud_billing

11:43:27 config.go:147: [INFO] Load config: /infrastructure-iac/.tflint.hcl
11:43:27 config.go:347: [DEBUG] Config loaded
11:43:27 config.go:348: [DEBUG]   CallModuleType: local
11:43:27 config.go:349: [DEBUG]   CallModuleTypeSet: true
11:43:27 config.go:350: [DEBUG]   Force: false
11:43:27 config.go:351: [DEBUG]   ForceSet: true
11:43:27 config.go:352: [DEBUG]   DisabledByDefault: false
11:43:27 config.go:353: [DEBUG]   DisabledByDefaultSet: true
11:43:27 config.go:354: [DEBUG]   PluginDir: ~/.tflint.d/plugins
11:43:27 config.go:355: [DEBUG]   PluginDirSet: true
11:43:27 config.go:356: [DEBUG]   Format: compact
11:43:27 config.go:357: [DEBUG]   FormatSet: true
11:43:27 config.go:358: [DEBUG]   Varfiles: 
11:43:27 config.go:359: [DEBUG]   Variables: 
11:43:27 config.go:360: [DEBUG]   Only: 
11:43:27 config.go:361: [DEBUG]   IgnoreModules:
11:43:27 config.go:365: [DEBUG]   Rules:
11:43:27 config.go:367: [DEBUG]     terraform_required_providers: false
11:43:27 config.go:367: [DEBUG]     terraform_required_version: false
11:43:27 config.go:369: [DEBUG]   Plugins:
11:43:27 config.go:371: [DEBUG]     terraform: enabled=true, version=, source=
11:43:27 config.go:371: [DEBUG]     google: enabled=true, version=0.30.0, source=github.com/terraform-linters/tflint-ruleset-google
11:43:27 option.go:91: [DEBUG] CLI Options
11:43:27 option.go:92: [DEBUG]   CallModuleType: local
11:43:27 option.go:93: [DEBUG]   Force: true
11:43:27 option.go:94: [DEBUG]   Format: 
11:43:27 option.go:95: [DEBUG]   Varfiles: 
11:43:27 option.go:96: [DEBUG]   Variables: 
11:43:27 option.go:97: [DEBUG]   EnableRules: 
11:43:27 option.go:98: [DEBUG]   DisableRules: 
11:43:27 option.go:99: [DEBUG]   Only: 
11:43:27 option.go:100: [DEBUG]   EnablePlugins: 
11:43:27 option.go:101: [DEBUG]   IgnoreModules:
11:43:27 loader.go:39: [INFO] Initialize new loader
11:43:27 loader.go:81: [INFO] Building the root module while calling local child modules...
11:43:27 runner.go:46: [INFO] Initialize new runner for root
11:43:27 discovery.go:33: [INFO] Plugin "terraform" is not installed, but the bundled plugin is available.
11:43:27 discovery.go:54: [INFO] Plugin "terraform" found
11:43:27 [DEBUG] cmdrunner/cmd_runner.go:73: starting plugin: path=/home/user/.local/share/mise/installs/tflint/0.52.0/bin/tflint args=["/home/user/.local/share/mise/installs/tflint/0.52.0/bin/tflint", "--act-as-bundled-plugin"]
11:43:27 [DEBUG] cmdrunner/cmd_runner.go:80: plugin started: path=/home/user/.local/share/mise/installs/tflint/0.52.0/bin/tflint pid=87768
11:43:27 [DEBUG] go-plugin@v1.6.1/client.go:827: waiting for RPC address: plugin=/home/user/.local/share/mise/installs/tflint/0.52.0/bin/tflint
11:43:27 [DEBUG] go-plugin@v1.6.1/client.go:1216: tflint: 11:43:27 [DEBUG] go-plugin@v1.6.1/server.go:419: plugin address: network=unix address=/tmp/plugin349105759
11:43:27 [DEBUG] go-plugin@v1.6.1/client.go:880: using plugin: version=11
11:43:27 discovery.go:90: [DEBUG] Find plugin path: /home/user/.tflint.d/plugins/github.com/terraform-linters/tflint-ruleset-google/0.30.0/tflint-ruleset-google
11:43:27 discovery.go:54: [INFO] Plugin "google" found
11:43:27 [DEBUG] cmdrunner/cmd_runner.go:73: starting plugin: path=/home/user/.tflint.d/plugins/github.com/terraform-linters/tflint-ruleset-google/0.30.0/tflint-ruleset-google args=["/home/user/.tflint.d/plugins/github.com/terraform-linters/tflint-ruleset-google/0.30.0/tflint-ruleset-google"]
11:43:27 [DEBUG] cmdrunner/cmd_runner.go:80: plugin started: path=/home/user/.tflint.d/plugins/github.com/terraform-linters/tflint-ruleset-google/0.30.0/tflint-ruleset-google pid=87846
11:43:27 [DEBUG] go-plugin@v1.6.1/client.go:827: waiting for RPC address: plugin=/home/user/.tflint.d/plugins/github.com/terraform-linters/tflint-ruleset-google/0.30.0/tflint-ruleset-google
11:43:27 [DEBUG] go-plugin@v1.6.1/client.go:1216: tflint-ruleset-google: 11:43:27 [DEBUG] go-plugin@v1.6.0/server.go:419: plugin address: network=unix address=/tmp/plugin2496096303
11:43:27 [DEBUG] go-plugin@v1.6.1/client.go:880: using plugin: version=11
11:43:27 [DEBUG] host2plugin/client.go:124: starting host-side gRPC server
11:43:27 [DEBUG] host2plugin/client.go:124: starting host-side gRPC server
11:43:27 [DEBUG] go-plugin@v1.6.1/grpc_stdio.go:142: stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = error reading from server: EOF"
11:43:27 [INFO]  go-plugin@v1.6.1/client.go:780: plugin process exited: plugin=/home/user/.tflint.d/plugins/github.com/terraform-linters/tflint-ruleset-google/0.30.0/tflint-ruleset-google id=87846
11:43:27 [DEBUG] go-plugin@v1.6.1/client.go:558: plugin exited
11:43:27 [DEBUG] go-plugin@v1.6.1/grpc_stdio.go:142: stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = error reading from server: EOF"
11:43:27 [INFO]  go-plugin@v1.6.1/client.go:780: plugin process exited: plugin=/home/user/.local/share/mise/installs/tflint/0.52.0/bin/tflint id=87768
11:43:27 [DEBUG] go-plugin@v1.6.1/client.go:558: plugin exited


│ An output to stderr found in google/modules/cloud_platform

11:43:27 config.go:147: [INFO] Load config: /infrastructure-iac/.tflint.hcl
11:43:27 config.go:347: [DEBUG] Config loaded
11:43:27 config.go:348: [DEBUG]   CallModuleType: local
11:43:27 config.go:349: [DEBUG]   CallModuleTypeSet: true
11:43:27 config.go:350: [DEBUG]   Force: false
11:43:27 config.go:351: [DEBUG]   ForceSet: true
11:43:27 config.go:352: [DEBUG]   DisabledByDefault: false
11:43:27 config.go:353: [DEBUG]   DisabledByDefaultSet: true
11:43:27 config.go:354: [DEBUG]   PluginDir: ~/.tflint.d/plugins
11:43:27 config.go:355: [DEBUG]   PluginDirSet: true
11:43:27 config.go:356: [DEBUG]   Format: compact
11:43:27 config.go:357: [DEBUG]   FormatSet: true
11:43:27 config.go:358: [DEBUG]   Varfiles: 
11:43:27 config.go:359: [DEBUG]   Variables: 
11:43:27 config.go:360: [DEBUG]   Only: 
11:43:27 config.go:361: [DEBUG]   IgnoreModules:
11:43:27 config.go:365: [DEBUG]   Rules:
11:43:27 config.go:367: [DEBUG]     terraform_required_providers: false
11:43:27 config.go:367: [DEBUG]     terraform_required_version: false
11:43:27 config.go:369: [DEBUG]   Plugins:
11:43:27 config.go:371: [DEBUG]     terraform: enabled=true, version=, source=
11:43:27 config.go:371: [DEBUG]     google: enabled=true, version=0.30.0, source=github.com/terraform-linters/tflint-ruleset-google
11:43:27 option.go:91: [DEBUG] CLI Options
11:43:27 option.go:92: [DEBUG]   CallModuleType: local
11:43:27 option.go:93: [DEBUG]   Force: true
11:43:27 option.go:94: [DEBUG]   Format: 
11:43:27 option.go:95: [DEBUG]   Varfiles: 
11:43:27 option.go:96: [DEBUG]   Variables: 
11:43:27 option.go:97: [DEBUG]   EnableRules: 
11:43:27 option.go:98: [DEBUG]   DisableRules: 
11:43:27 option.go:99: [DEBUG]   Only: 
11:43:27 option.go:100: [DEBUG]   EnablePlugins: 
11:43:27 option.go:101: [DEBUG]   IgnoreModules:
11:43:27 loader.go:39: [INFO] Initialize new loader
11:43:27 loader.go:81: [INFO] Building the root module while calling local child modules...
11:43:27 runner.go:46: [INFO] Initialize new runner for root
11:43:27 discovery.go:33: [INFO] Plugin "terraform" is not installed, but the bundled plugin is available.
11:43:27 discovery.go:54: [INFO] Plugin "terraform" found
11:43:27 [DEBUG] cmdrunner/cmd_runner.go:73: starting plugin: path=/home/user/.local/share/mise/installs/tflint/0.52.0/bin/tflint args=["/home/user/.local/share/mise/installs/tflint/0.52.0/bin/tflint", "--act-as-bundled-plugin"]
11:43:27 [DEBUG] cmdrunner/cmd_runner.go:80: plugin started: path=/home/user/.local/share/mise/installs/tflint/0.52.0/bin/tflint pid=87766
11:43:27 [DEBUG] go-plugin@v1.6.1/client.go:827: waiting for RPC address: plugin=/home/user/.local/share/mise/installs/tflint/0.52.0/bin/tflint
11:43:27 [DEBUG] go-plugin@v1.6.1/client.go:1216: tflint: 11:43:27 [DEBUG] go-plugin@v1.6.1/server.go:419: plugin address: network=unix address=/tmp/plugin810266682
11:43:27 [DEBUG] go-plugin@v1.6.1/client.go:880: using plugin: version=11
11:43:27 discovery.go:90: [DEBUG] Find plugin path: /home/user/.tflint.d/plugins/github.com/terraform-linters/tflint-ruleset-google/0.30.0/tflint-ruleset-google
11:43:27 discovery.go:54: [INFO] Plugin "google" found
11:43:27 [DEBUG] cmdrunner/cmd_runner.go:73: starting plugin: path=/home/user/.tflint.d/plugins/github.com/terraform-linters/tflint-ruleset-google/0.30.0/tflint-ruleset-google args=["/home/user/.tflint.d/plugins/github.com/terraform-linters/tflint-ruleset-google/0.30.0/tflint-ruleset-google"]
11:43:27 [DEBUG] cmdrunner/cmd_runner.go:80: plugin started: path=/home/user/.tflint.d/plugins/github.com/terraform-linters/tflint-ruleset-google/0.30.0/tflint-ruleset-google pid=87829
11:43:27 [DEBUG] go-plugin@v1.6.1/client.go:827: waiting for RPC address: plugin=/home/user/.tflint.d/plugins/github.com/terraform-linters/tflint-ruleset-google/0.30.0/tflint-ruleset-google
11:43:27 [DEBUG] go-plugin@v1.6.1/client.go:1216: tflint-ruleset-google: 11:43:27 [DEBUG] go-plugin@v1.6.0/server.go:419: plugin address: network=unix address=/tmp/plugin3579353062
11:43:27 [DEBUG] go-plugin@v1.6.1/client.go:880: using plugin: version=11
11:43:27 [DEBUG] host2plugin/client.go:124: starting host-side gRPC server
11:43:27 [DEBUG] host2plugin/client.go:124: starting host-side gRPC server
11:43:27 [DEBUG] go-plugin@v1.6.1/grpc_stdio.go:142: stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = error reading from server: EOF"
11:43:27 [INFO]  go-plugin@v1.6.1/client.go:780: plugin process exited: plugin=/home/user/.local/share/mise/installs/tflint/0.52.0/bin/tflint id=87766
11:43:27 [DEBUG] go-plugin@v1.6.1/client.go:558: plugin exited
11:43:27 [DEBUG] go-plugin@v1.6.1/grpc_stdio.go:142: stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = error reading from server: EOF"
11:43:27 [INFO]  go-plugin@v1.6.1/client.go:780: plugin process exited: plugin=/home/user/.tflint.d/plugins/github.com/terraform-linters/tflint-ruleset-google/0.30.0/tflint-ruleset-google id=87829
11:43:27 [DEBUG] go-plugin@v1.6.1/client.go:558: plugin exited


│ An output to stderr found in google/modules/cloud_pubsub

11:43:27 config.go:147: [INFO] Load config: /infrastructure-iac/.tflint.hcl
11:43:27 config.go:347: [DEBUG] Config loaded
11:43:27 config.go:348: [DEBUG]   CallModuleType: local
11:43:27 config.go:349: [DEBUG]   CallModuleTypeSet: true
11:43:27 config.go:350: [DEBUG]   Force: false
11:43:27 config.go:351: [DEBUG]   ForceSet: true
11:43:27 config.go:352: [DEBUG]   DisabledByDefault: false
11:43:27 config.go:353: [DEBUG]   DisabledByDefaultSet: true
11:43:27 config.go:354: [DEBUG]   PluginDir: ~/.tflint.d/plugins
11:43:27 config.go:355: [DEBUG]   PluginDirSet: true
11:43:27 config.go:356: [DEBUG]   Format: compact
11:43:27 config.go:357: [DEBUG]   FormatSet: true
11:43:27 config.go:358: [DEBUG]   Varfiles: 
11:43:27 config.go:359: [DEBUG]   Variables: 
11:43:27 config.go:360: [DEBUG]   Only: 
11:43:27 config.go:361: [DEBUG]   IgnoreModules:
11:43:27 config.go:365: [DEBUG]   Rules:
11:43:27 config.go:367: [DEBUG]     terraform_required_version: false
11:43:27 config.go:367: [DEBUG]     terraform_required_providers: false
11:43:27 config.go:369: [DEBUG]   Plugins:
11:43:27 config.go:371: [DEBUG]     terraform: enabled=true, version=, source=
11:43:27 config.go:371: [DEBUG]     google: enabled=true, version=0.30.0, source=github.com/terraform-linters/tflint-ruleset-google
11:43:27 option.go:91: [DEBUG] CLI Options
11:43:27 option.go:92: [DEBUG]   CallModuleType: local
11:43:27 option.go:93: [DEBUG]   Force: true
11:43:27 option.go:94: [DEBUG]   Format: 
11:43:27 option.go:95: [DEBUG]   Varfiles: 
11:43:27 option.go:96: [DEBUG]   Variables: 
11:43:27 option.go:97: [DEBUG]   EnableRules: 
11:43:27 option.go:98: [DEBUG]   DisableRules: 
11:43:27 option.go:99: [DEBUG]   Only: 
11:43:27 option.go:100: [DEBUG]   EnablePlugins: 
11:43:27 option.go:101: [DEBUG]   IgnoreModules:
11:43:27 loader.go:39: [INFO] Initialize new loader
11:43:27 loader.go:81: [INFO] Building the root module while calling local child modules...
11:43:27 runner.go:46: [INFO] Initialize new runner for root
11:43:27 discovery.go:90: [DEBUG] Find plugin path: /home/user/.tflint.d/plugins/github.com/terraform-linters/tflint-ruleset-google/0.30.0/tflint-ruleset-google
11:43:27 discovery.go:54: [INFO] Plugin "google" found
11:43:27 [DEBUG] cmdrunner/cmd_runner.go:73: starting plugin: path=/home/user/.tflint.d/plugins/github.com/terraform-linters/tflint-ruleset-google/0.30.0/tflint-ruleset-google args=["/home/user/.tflint.d/plugins/github.com/terraform-linters/tflint-ruleset-google/0.30.0/tflint-ruleset-google"]
11:43:27 [DEBUG] cmdrunner/cmd_runner.go:80: plugin started: path=/home/user/.tflint.d/plugins/github.com/terraform-linters/tflint-ruleset-google/0.30.0/tflint-ruleset-google pid=87767
11:43:27 [DEBUG] go-plugin@v1.6.1/client.go:827: waiting for RPC address: plugin=/home/user/.tflint.d/plugins/github.com/terraform-linters/tflint-ruleset-google/0.30.0/tflint-ruleset-google
11:43:27 [DEBUG] go-plugin@v1.6.1/client.go:880: using plugin: version=11
11:43:27 [DEBUG] go-plugin@v1.6.1/client.go:1216: tflint-ruleset-google: 11:43:27 [DEBUG] go-plugin@v1.6.0/server.go:419: plugin address: network=unix address=/tmp/plugin2353926140
11:43:27 discovery.go:33: [INFO] Plugin "terraform" is not installed, but the bundled plugin is available.
11:43:27 discovery.go:54: [INFO] Plugin "terraform" found
11:43:27 [DEBUG] cmdrunner/cmd_runner.go:73: starting plugin: path=/home/user/.local/share/mise/installs/tflint/0.52.0/bin/tflint args=["/home/user/.local/share/mise/installs/tflint/0.52.0/bin/tflint", "--act-as-bundled-plugin"]
11:43:27 [DEBUG] cmdrunner/cmd_runner.go:80: plugin started: path=/home/user/.local/share/mise/installs/tflint/0.52.0/bin/tflint pid=87816
11:43:27 [DEBUG] go-plugin@v1.6.1/client.go:827: waiting for RPC address: plugin=/home/user/.local/share/mise/installs/tflint/0.52.0/bin/tflint
11:43:27 [DEBUG] go-plugin@v1.6.1/client.go:1216: tflint: 11:43:27 [DEBUG] go-plugin@v1.6.1/server.go:419: plugin address: network=unix address=/tmp/plugin1157538928
11:43:27 [DEBUG] go-plugin@v1.6.1/client.go:880: using plugin: version=11
11:43:27 [DEBUG] host2plugin/client.go:124: starting host-side gRPC server
11:43:27 [DEBUG] host2plugin/client.go:124: starting host-side gRPC server
11:43:27 [DEBUG] go-plugin@v1.6.1/grpc_stdio.go:142: stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = error reading from server: EOF"
11:43:27 [INFO]  go-plugin@v1.6.1/client.go:780: plugin process exited: plugin=/home/user/.tflint.d/plugins/github.com/terraform-linters/tflint-ruleset-google/0.30.0/tflint-ruleset-google id=87767
11:43:27 [DEBUG] go-plugin@v1.6.1/client.go:558: plugin exited
11:43:27 [DEBUG] go-plugin@v1.6.1/grpc_stdio.go:142: stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = error reading from server: EOF"
11:43:27 [INFO]  go-plugin@v1.6.1/client.go:780: plugin process exited: plugin=/home/user/.local/share/mise/installs/tflint/0.52.0/bin/tflint id=87816
11:43:27 [DEBUG] go-plugin@v1.6.1/client.go:558: plugin exited


11:43:29 inspect_parallel.go:66: [DEBUG] Failed to run in google; exit status 1; stdout=
│ Failed to run in google; exit status 1

11:43:27 config.go:147: [INFO] Load config: /infrastructure-iac/.tflint.hcl
11:43:27 config.go:347: [DEBUG] Config loaded
11:43:27 config.go:348: [DEBUG]   CallModuleType: local
11:43:27 config.go:349: [DEBUG]   CallModuleTypeSet: true
11:43:27 config.go:350: [DEBUG]   Force: false
11:43:27 config.go:351: [DEBUG]   ForceSet: true
11:43:27 config.go:352: [DEBUG]   DisabledByDefault: false
11:43:27 config.go:353: [DEBUG]   DisabledByDefaultSet: true
11:43:27 config.go:354: [DEBUG]   PluginDir: ~/.tflint.d/plugins
11:43:27 config.go:355: [DEBUG]   PluginDirSet: true
11:43:27 config.go:356: [DEBUG]   Format: compact
11:43:27 config.go:357: [DEBUG]   FormatSet: true
11:43:27 config.go:358: [DEBUG]   Varfiles: 
11:43:27 config.go:359: [DEBUG]   Variables: 
11:43:27 config.go:360: [DEBUG]   Only: 
11:43:27 config.go:361: [DEBUG]   IgnoreModules:
11:43:27 config.go:365: [DEBUG]   Rules:
11:43:27 config.go:367: [DEBUG]     terraform_required_providers: false
11:43:27 config.go:367: [DEBUG]     terraform_required_version: false
11:43:27 config.go:369: [DEBUG]   Plugins:
11:43:27 config.go:371: [DEBUG]     terraform: enabled=true, version=, source=
11:43:27 config.go:371: [DEBUG]     google: enabled=true, version=0.30.0, source=github.com/terraform-linters/tflint-ruleset-google
11:43:27 option.go:91: [DEBUG] CLI Options
11:43:27 option.go:92: [DEBUG]   CallModuleType: local
11:43:27 option.go:93: [DEBUG]   Force: true
11:43:27 option.go:94: [DEBUG]   Format: 
11:43:27 option.go:95: [DEBUG]   Varfiles: 
11:43:27 option.go:96: [DEBUG]   Variables: 
11:43:27 option.go:97: [DEBUG]   EnableRules: 
11:43:27 option.go:98: [DEBUG]   DisableRules: 
11:43:27 option.go:99: [DEBUG]   Only: 
11:43:27 option.go:100: [DEBUG]   EnablePlugins: 
11:43:27 option.go:101: [DEBUG]   IgnoreModules:
11:43:27 loader.go:39: [INFO] Initialize new loader
11:43:27 module_mgr.go:63: [INFO] Module manifest file found. Initializing...
11:43:27 loader.go:81: [INFO] Building the root module while calling local child modules...
11:43:27 loader.go:108: [DEBUG] Trying to load the local module: name=cloud_billing dir=modules/cloud_billing
11:43:27 loader.go:108: [DEBUG] Trying to load the local module: name=cloud_platform dir=modules/cloud_platform
11:43:27 loader.go:108: [DEBUG] Trying to load the local module: name=cloud_pubsub dir=modules/cloud_pubsub
11:43:27 runner.go:46: [INFO] Initialize new runner for root
11:43:27 runner.go:46: [INFO] Initialize new runner for module.cloud_platform
11:43:27 runner.go:46: [INFO] Initialize new runner for module.cloud_pubsub
11:43:27 discovery.go:33: [INFO] Plugin "terraform" is not installed, but the bundled plugin is available.
11:43:27 discovery.go:54: [INFO] Plugin "terraform" found
11:43:27 [DEBUG] cmdrunner/cmd_runner.go:73: starting plugin: path=/home/user/.local/share/mise/installs/tflint/0.52.0/bin/tflint args=["/home/user/.local/share/mise/installs/tflint/0.52.0/bin/tflint", "--act-as-bundled-plugin"]
11:43:27 [DEBUG] cmdrunner/cmd_runner.go:80: plugin started: path=/home/user/.local/share/mise/installs/tflint/0.52.0/bin/tflint pid=87777
11:43:27 [DEBUG] go-plugin@v1.6.1/client.go:827: waiting for RPC address: plugin=/home/user/.local/share/mise/installs/tflint/0.52.0/bin/tflint
11:43:27 [DEBUG] go-plugin@v1.6.1/client.go:1216: tflint: 11:43:27 [DEBUG] go-plugin@v1.6.1/server.go:419: plugin address: network=unix address=/tmp/plugin1797505665
11:43:27 [DEBUG] go-plugin@v1.6.1/client.go:880: using plugin: version=11
11:43:27 discovery.go:90: [DEBUG] Find plugin path: /home/user/.tflint.d/plugins/github.com/terraform-linters/tflint-ruleset-google/0.30.0/tflint-ruleset-google
11:43:27 discovery.go:54: [INFO] Plugin "google" found
11:43:27 [DEBUG] cmdrunner/cmd_runner.go:73: starting plugin: path=/home/user/.tflint.d/plugins/github.com/terraform-linters/tflint-ruleset-google/0.30.0/tflint-ruleset-google args=["/home/user/.tflint.d/plugins/github.com/terraform-linters/tflint-ruleset-google/0.30.0/tflint-ruleset-google"]
11:43:27 [DEBUG] cmdrunner/cmd_runner.go:80: plugin started: path=/home/user/.tflint.d/plugins/github.com/terraform-linters/tflint-ruleset-google/0.30.0/tflint-ruleset-google pid=87847
11:43:27 [DEBUG] go-plugin@v1.6.1/client.go:827: waiting for RPC address: plugin=/home/user/.tflint.d/plugins/github.com/terraform-linters/tflint-ruleset-google/0.30.0/tflint-ruleset-google
11:43:27 [DEBUG] go-plugin@v1.6.1/client.go:880: using plugin: version=11
11:43:27 [DEBUG] go-plugin@v1.6.1/client.go:1216: tflint-ruleset-google: 11:43:27 [DEBUG] go-plugin@v1.6.0/server.go:419: plugin address: network=unix address=/tmp/plugin3047053840
11:43:27 [DEBUG] host2plugin/client.go:124: starting host-side gRPC server
11:43:27 [DEBUG] host2plugin/client.go:124: starting host-side gRPC server
11:43:27 [DEBUG] host2plugin/client.go:124: starting host-side gRPC server
11:43:27 [DEBUG] host2plugin/client.go:124: starting host-side gRPC server
11:43:29 [DEBUG] host2plugin/client.go:124: starting host-side gRPC server
11:43:29 [DEBUG] host2plugin/client.go:124: starting host-side gRPC server
11:43:29 [ERROR] interceptor/logging.go:18: failed to gRPC request: direction=plugin2host method=/proto.Runner/GetModuleContent err="rpc error: code = FailedPrecondition desc = google/main.tf:20,13-29: circular reference found; local.project_id -> local.project_id"
11:43:29 [DEBUG] go-plugin@v1.6.1/client.go:1216: tflint-ruleset-google: 11:43:29 [ERROR] interceptor/logging.go:18: failed to gRPC request: direction=host2plugin method=/proto.RuleSet/Check err="rpc error: code = FailedPrecondition desc = google/main.tf:20,13-29: circular reference found; local.project_id -> local.project_id"
11:43:29 server.go:80: [DEBUG] The file "google/main.tf" is not found in the current module. Fall back to global caches.
11:43:29 [DEBUG] go-plugin@v1.6.1/grpc_stdio.go:142: stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = error reading from server: EOF"
11:43:29 [INFO]  go-plugin@v1.6.1/client.go:780: plugin process exited: plugin=/home/user/.local/share/mise/installs/tflint/0.52.0/bin/tflint id=87777
11:43:29 [DEBUG] go-plugin@v1.6.1/client.go:558: plugin exited
11:43:29 [DEBUG] go-plugin@v1.6.1/grpc_stdio.go:142: stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = error reading from server: EOF"
11:43:29 [INFO]  go-plugin@v1.6.1/client.go:780: plugin process exited: plugin=/home/user/.tflint.d/plugins/github.com/terraform-linters/tflint-ruleset-google/0.30.0/tflint-ruleset-google id=87847
11:43:29 [DEBUG] go-plugin@v1.6.1/client.go:558: plugin exited
Failed to check ruleset; google/main.tf:20,13-29: circular reference found; local.project_id -> local.project_id

TFLint Version

0.52.0

Terraform Version

1.9.3

Operating System

  • Linux
  • macOS
  • Windows
@wata727
Copy link
Member

wata727 commented Aug 7, 2024

Thank you for your detailed report.
You're right, this seems like an interesting bug caused by a race condition.

Here's a minimal repro code:

main.tf

locals {
  project_id = "..."
}

provider "google" {
  project = local.project_id
}

module "module" {
  source = "./module"

  count = 10
}

.tflint.hcl

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

  deep_check = true
}
$ tflint
Failed to check ruleset; main.tf:6,13-29: circular reference found; local.project_id -> local.project_id

Here is the output from go build -race -o tflint-race showing a warning about a race condition:

==================
WARNING: DATA RACE
Read at 0x00c000514868 by goroutine 320:
  github.com/terraform-linters/tflint/terraform.(*CallStack).Push()
      /workspaces/tflint/terraform/evaluator.go:37 +0x72
  github.com/terraform-linters/tflint/terraform.(*evaluationData).GetLocalValue()
      /workspaces/tflint/terraform/evaluator.go:260 +0x3f7
  github.com/terraform-linters/tflint/terraform/lang.(*Scope).evalContext()
      /workspaces/tflint/terraform/lang/eval.go:171 +0x1242
  github.com/terraform-linters/tflint/terraform/lang.(*Scope).EvalContext()
      /workspaces/tflint/terraform/lang/eval.go:92 +0x344
  github.com/terraform-linters/tflint/terraform/lang.(*Scope).ExpandBlock()
      /workspaces/tflint/terraform/lang/eval.go:33 +0x302
  github.com/terraform-linters/tflint/terraform.(*Evaluator).ExpandBlock()
      /workspaces/tflint/terraform/evaluator.go:101 +0x1bb
  github.com/terraform-linters/tflint/terraform.(*Module).PartialContent()
      /workspaces/tflint/terraform/module.go:132 +0x204
  github.com/terraform-linters/tflint/plugin.(*GRPCServer).GetModuleContent()
      /workspaces/tflint/plugin/server.go:70 +0x214
  github.com/terraform-linters/tflint-plugin-sdk/plugin/internal/plugin2host.(*GRPCServer).GetModuleContent()
      /go/pkg/mod/github.com/terraform-linters/tflint-plugin-sdk@v0.21.0/plugin/internal/plugin2host/server.go:62 +0x130
  github.com/terraform-linters/tflint-plugin-sdk/plugin/internal/proto._Runner_GetModuleContent_Handler.func1()
      /go/pkg/mod/github.com/terraform-linters/tflint-plugin-sdk@v0.21.0/plugin/internal/proto/tflint_grpc.pb.go:632 +0xbe
  github.com/terraform-linters/tflint-plugin-sdk/plugin/internal/host2plugin.(*GRPCClient).Check.func1.RequestLogging.1()
      /go/pkg/mod/github.com/terraform-linters/tflint-plugin-sdk@v0.21.0/plugin/internal/interceptor/logging.go:16 +0x2bc
  github.com/terraform-linters/tflint-plugin-sdk/plugin/internal/proto._Runner_GetModuleContent_Handler()
      /go/pkg/mod/github.com/terraform-linters/tflint-plugin-sdk@v0.21.0/plugin/internal/proto/tflint_grpc.pb.go:634 +0x1f3
  google.golang.org/grpc.(*Server).processUnaryRPC()
      /go/pkg/mod/google.golang.org/grpc@v1.65.0/server.go:1379 +0x1a2c
  google.golang.org/grpc.(*Server).handleStream()
      /go/pkg/mod/google.golang.org/grpc@v1.65.0/server.go:1790 +0x1824
  google.golang.org/grpc.(*Server).serveStreams.func2.1()
      /go/pkg/mod/google.golang.org/grpc@v1.65.0/server.go:1029 +0x158

Previous write at 0x00c000514868 by goroutine 319:
  github.com/terraform-linters/tflint/terraform.(*CallStack).Push()
      /workspaces/tflint/terraform/evaluator.go:37 +0x130
  github.com/terraform-linters/tflint/terraform.(*evaluationData).GetLocalValue()
      /workspaces/tflint/terraform/evaluator.go:260 +0x3f7
  github.com/terraform-linters/tflint/terraform/lang.(*Scope).evalContext()
      /workspaces/tflint/terraform/lang/eval.go:171 +0x1242
  github.com/terraform-linters/tflint/terraform/lang.(*Scope).EvalContext()
      /workspaces/tflint/terraform/lang/eval.go:92 +0x344
  github.com/terraform-linters/tflint/terraform/lang.(*Scope).ExpandBlock()
      /workspaces/tflint/terraform/lang/eval.go:33 +0x302
  github.com/terraform-linters/tflint/terraform.(*Evaluator).ExpandBlock()
      /workspaces/tflint/terraform/evaluator.go:101 +0x1bb
  github.com/terraform-linters/tflint/terraform.(*Module).PartialContent()
      /workspaces/tflint/terraform/module.go:132 +0x204
  github.com/terraform-linters/tflint/plugin.(*GRPCServer).GetModuleContent()
      /workspaces/tflint/plugin/server.go:70 +0x214
  github.com/terraform-linters/tflint-plugin-sdk/plugin/internal/plugin2host.(*GRPCServer).GetModuleContent()
      /go/pkg/mod/github.com/terraform-linters/tflint-plugin-sdk@v0.21.0/plugin/internal/plugin2host/server.go:62 +0x130
  github.com/terraform-linters/tflint-plugin-sdk/plugin/internal/proto._Runner_GetModuleContent_Handler.func1()
      /go/pkg/mod/github.com/terraform-linters/tflint-plugin-sdk@v0.21.0/plugin/internal/proto/tflint_grpc.pb.go:632 +0xbe
  github.com/terraform-linters/tflint-plugin-sdk/plugin/internal/host2plugin.(*GRPCClient).Check.func1.RequestLogging.1()
      /go/pkg/mod/github.com/terraform-linters/tflint-plugin-sdk@v0.21.0/plugin/internal/interceptor/logging.go:16 +0x2bc
  github.com/terraform-linters/tflint-plugin-sdk/plugin/internal/proto._Runner_GetModuleContent_Handler()
      /go/pkg/mod/github.com/terraform-linters/tflint-plugin-sdk@v0.21.0/plugin/internal/proto/tflint_grpc.pb.go:634 +0x1f3
  google.golang.org/grpc.(*Server).processUnaryRPC()
      /go/pkg/mod/google.golang.org/grpc@v1.65.0/server.go:1379 +0x1a2c
  google.golang.org/grpc.(*Server).handleStream()
      /go/pkg/mod/google.golang.org/grpc@v1.65.0/server.go:1790 +0x1824
  google.golang.org/grpc.(*Server).serveStreams.func2.1()
      /go/pkg/mod/google.golang.org/grpc@v1.65.0/server.go:1029 +0x158

Goroutine 320 (running) created at:
  google.golang.org/grpc.(*Server).serveStreams.func2()
      /go/pkg/mod/google.golang.org/grpc@v1.65.0/server.go:1040 +0x224
  google.golang.org/grpc/internal/transport.(*http2Server).operateHeaders()
      /go/pkg/mod/google.golang.org/grpc@v1.65.0/internal/transport/http2_server.go:630 +0x3a41
  google.golang.org/grpc/internal/transport.(*http2Server).HandleStreams()
      /go/pkg/mod/google.golang.org/grpc@v1.65.0/internal/transport/http2_server.go:671 +0x406
  google.golang.org/grpc.(*Server).serveStreams()
      /go/pkg/mod/google.golang.org/grpc@v1.65.0/server.go:1023 +0x69b
  google.golang.org/grpc.(*Server).handleRawConn.func1()
      /go/pkg/mod/google.golang.org/grpc@v1.65.0/server.go:959 +0x86

Goroutine 319 (running) created at:
  google.golang.org/grpc.(*Server).serveStreams.func2()
      /go/pkg/mod/google.golang.org/grpc@v1.65.0/server.go:1040 +0x224
  google.golang.org/grpc/internal/transport.(*http2Server).operateHeaders()
      /go/pkg/mod/google.golang.org/grpc@v1.65.0/internal/transport/http2_server.go:630 +0x3a41
  google.golang.org/grpc/internal/transport.(*http2Server).HandleStreams()
      /go/pkg/mod/google.golang.org/grpc@v1.65.0/internal/transport/http2_server.go:671 +0x406
  google.golang.org/grpc.(*Server).serveStreams()
      /go/pkg/mod/google.golang.org/grpc@v1.65.0/server.go:1023 +0x69b
  google.golang.org/grpc.(*Server).handleRawConn.func1()
      /go/pkg/mod/google.golang.org/grpc@v1.65.0/server.go:959 +0x86
==================
==================
WARNING: DATA RACE
Read at 0x00c0000ab4d0 by goroutine 320:
  runtime.growslice()
      /usr/local/go/src/runtime/slice.go:155 +0x0
  github.com/terraform-linters/tflint/terraform.(*CallStack).Push()
      /workspaces/tflint/terraform/evaluator.go:37 +0xab
  github.com/terraform-linters/tflint/terraform.(*evaluationData).GetLocalValue()
      /workspaces/tflint/terraform/evaluator.go:260 +0x3f7
  github.com/terraform-linters/tflint/terraform/lang.(*Scope).evalContext()
      /workspaces/tflint/terraform/lang/eval.go:171 +0x1242
  github.com/terraform-linters/tflint/terraform/lang.(*Scope).EvalContext()
      /workspaces/tflint/terraform/lang/eval.go:92 +0x344
  github.com/terraform-linters/tflint/terraform/lang.(*Scope).ExpandBlock()
      /workspaces/tflint/terraform/lang/eval.go:33 +0x302
  github.com/terraform-linters/tflint/terraform.(*Evaluator).ExpandBlock()
      /workspaces/tflint/terraform/evaluator.go:101 +0x1bb
  github.com/terraform-linters/tflint/terraform.(*Module).PartialContent()
      /workspaces/tflint/terraform/module.go:132 +0x204
  github.com/terraform-linters/tflint/plugin.(*GRPCServer).GetModuleContent()
      /workspaces/tflint/plugin/server.go:70 +0x214
  github.com/terraform-linters/tflint-plugin-sdk/plugin/internal/plugin2host.(*GRPCServer).GetModuleContent()
      /go/pkg/mod/github.com/terraform-linters/tflint-plugin-sdk@v0.21.0/plugin/internal/plugin2host/server.go:62 +0x130
  github.com/terraform-linters/tflint-plugin-sdk/plugin/internal/proto._Runner_GetModuleContent_Handler.func1()
      /go/pkg/mod/github.com/terraform-linters/tflint-plugin-sdk@v0.21.0/plugin/internal/proto/tflint_grpc.pb.go:632 +0xbe
  github.com/terraform-linters/tflint-plugin-sdk/plugin/internal/host2plugin.(*GRPCClient).Check.func1.RequestLogging.1()
      /go/pkg/mod/github.com/terraform-linters/tflint-plugin-sdk@v0.21.0/plugin/internal/interceptor/logging.go:16 +0x2bc
  github.com/terraform-linters/tflint-plugin-sdk/plugin/internal/proto._Runner_GetModuleContent_Handler()
      /go/pkg/mod/github.com/terraform-linters/tflint-plugin-sdk@v0.21.0/plugin/internal/proto/tflint_grpc.pb.go:634 +0x1f3
  google.golang.org/grpc.(*Server).processUnaryRPC()
      /go/pkg/mod/google.golang.org/grpc@v1.65.0/server.go:1379 +0x1a2c
  google.golang.org/grpc.(*Server).handleStream()
      /go/pkg/mod/google.golang.org/grpc@v1.65.0/server.go:1790 +0x1824
  google.golang.org/grpc.(*Server).serveStreams.func2.1()
      /go/pkg/mod/google.golang.org/grpc@v1.65.0/server.go:1029 +0x158

Previous write at 0x00c0000ab4d0 by goroutine 319:
  github.com/terraform-linters/tflint/terraform.(*CallStack).Push()
      /workspaces/tflint/terraform/evaluator.go:37 +0xdd
  github.com/terraform-linters/tflint/terraform.(*evaluationData).GetLocalValue()
      /workspaces/tflint/terraform/evaluator.go:260 +0x3f7
  github.com/terraform-linters/tflint/terraform/lang.(*Scope).evalContext()
      /workspaces/tflint/terraform/lang/eval.go:171 +0x1242
  github.com/terraform-linters/tflint/terraform/lang.(*Scope).EvalContext()
      /workspaces/tflint/terraform/lang/eval.go:92 +0x344
  github.com/terraform-linters/tflint/terraform/lang.(*Scope).ExpandBlock()
      /workspaces/tflint/terraform/lang/eval.go:33 +0x302
  github.com/terraform-linters/tflint/terraform.(*Evaluator).ExpandBlock()
      /workspaces/tflint/terraform/evaluator.go:101 +0x1bb
  github.com/terraform-linters/tflint/terraform.(*Module).PartialContent()
      /workspaces/tflint/terraform/module.go:132 +0x204
  github.com/terraform-linters/tflint/plugin.(*GRPCServer).GetModuleContent()
      /workspaces/tflint/plugin/server.go:70 +0x214
  github.com/terraform-linters/tflint-plugin-sdk/plugin/internal/plugin2host.(*GRPCServer).GetModuleContent()
      /go/pkg/mod/github.com/terraform-linters/tflint-plugin-sdk@v0.21.0/plugin/internal/plugin2host/server.go:62 +0x130
  github.com/terraform-linters/tflint-plugin-sdk/plugin/internal/proto._Runner_GetModuleContent_Handler.func1()
      /go/pkg/mod/github.com/terraform-linters/tflint-plugin-sdk@v0.21.0/plugin/internal/proto/tflint_grpc.pb.go:632 +0xbe
  github.com/terraform-linters/tflint-plugin-sdk/plugin/internal/host2plugin.(*GRPCClient).Check.func1.RequestLogging.1()
      /go/pkg/mod/github.com/terraform-linters/tflint-plugin-sdk@v0.21.0/plugin/internal/interceptor/logging.go:16 +0x2bc
  github.com/terraform-linters/tflint-plugin-sdk/plugin/internal/proto._Runner_GetModuleContent_Handler()
      /go/pkg/mod/github.com/terraform-linters/tflint-plugin-sdk@v0.21.0/plugin/internal/proto/tflint_grpc.pb.go:634 +0x1f3
  google.golang.org/grpc.(*Server).processUnaryRPC()
      /go/pkg/mod/google.golang.org/grpc@v1.65.0/server.go:1379 +0x1a2c
  google.golang.org/grpc.(*Server).handleStream()
      /go/pkg/mod/google.golang.org/grpc@v1.65.0/server.go:1790 +0x1824
  google.golang.org/grpc.(*Server).serveStreams.func2.1()
      /go/pkg/mod/google.golang.org/grpc@v1.65.0/server.go:1029 +0x158

Goroutine 320 (running) created at:
  google.golang.org/grpc.(*Server).serveStreams.func2()
      /go/pkg/mod/google.golang.org/grpc@v1.65.0/server.go:1040 +0x224
  google.golang.org/grpc/internal/transport.(*http2Server).operateHeaders()
      /go/pkg/mod/google.golang.org/grpc@v1.65.0/internal/transport/http2_server.go:630 +0x3a41
  google.golang.org/grpc/internal/transport.(*http2Server).HandleStreams()
      /go/pkg/mod/google.golang.org/grpc@v1.65.0/internal/transport/http2_server.go:671 +0x406
  google.golang.org/grpc.(*Server).serveStreams()
      /go/pkg/mod/google.golang.org/grpc@v1.65.0/server.go:1023 +0x69b
  google.golang.org/grpc.(*Server).handleRawConn.func1()
      /go/pkg/mod/google.golang.org/grpc@v1.65.0/server.go:959 +0x86

Goroutine 319 (running) created at:
  google.golang.org/grpc.(*Server).serveStreams.func2()
      /go/pkg/mod/google.golang.org/grpc@v1.65.0/server.go:1040 +0x224
  google.golang.org/grpc/internal/transport.(*http2Server).operateHeaders()
      /go/pkg/mod/google.golang.org/grpc@v1.65.0/internal/transport/http2_server.go:630 +0x3a41
  google.golang.org/grpc/internal/transport.(*http2Server).HandleStreams()
      /go/pkg/mod/google.golang.org/grpc@v1.65.0/internal/transport/http2_server.go:671 +0x406
  google.golang.org/grpc.(*Server).serveStreams()
      /go/pkg/mod/google.golang.org/grpc@v1.65.0/server.go:1023 +0x69b
  google.golang.org/grpc.(*Server).handleRawConn.func1()
      /go/pkg/mod/google.golang.org/grpc@v1.65.0/server.go:959 +0x86
==================
==================
WARNING: DATA RACE
Read at 0x00c0005d7770 by goroutine 320:
  runtime.mapaccess2_faststr()
      /usr/local/go/src/runtime/map_faststr.go:108 +0x0
  github.com/terraform-linters/tflint/terraform.(*CallStack).Push()
      /workspaces/tflint/terraform/evaluator.go:39 +0x208
  github.com/terraform-linters/tflint/terraform.(*evaluationData).GetLocalValue()
      /workspaces/tflint/terraform/evaluator.go:260 +0x3f7
  github.com/terraform-linters/tflint/terraform/lang.(*Scope).evalContext()
      /workspaces/tflint/terraform/lang/eval.go:171 +0x1242
  github.com/terraform-linters/tflint/terraform/lang.(*Scope).EvalContext()
      /workspaces/tflint/terraform/lang/eval.go:92 +0x344
  github.com/terraform-linters/tflint/terraform/lang.(*Scope).ExpandBlock()
      /workspaces/tflint/terraform/lang/eval.go:33 +0x302
  github.com/terraform-linters/tflint/terraform.(*Evaluator).ExpandBlock()
      /workspaces/tflint/terraform/evaluator.go:101 +0x1bb
  github.com/terraform-linters/tflint/terraform.(*Module).PartialContent()
      /workspaces/tflint/terraform/module.go:132 +0x204
  github.com/terraform-linters/tflint/plugin.(*GRPCServer).GetModuleContent()
      /workspaces/tflint/plugin/server.go:70 +0x214
  github.com/terraform-linters/tflint-plugin-sdk/plugin/internal/plugin2host.(*GRPCServer).GetModuleContent()
      /go/pkg/mod/github.com/terraform-linters/tflint-plugin-sdk@v0.21.0/plugin/internal/plugin2host/server.go:62 +0x130
  github.com/terraform-linters/tflint-plugin-sdk/plugin/internal/proto._Runner_GetModuleContent_Handler.func1()
      /go/pkg/mod/github.com/terraform-linters/tflint-plugin-sdk@v0.21.0/plugin/internal/proto/tflint_grpc.pb.go:632 +0xbe
  github.com/terraform-linters/tflint-plugin-sdk/plugin/internal/host2plugin.(*GRPCClient).Check.func1.RequestLogging.1()
      /go/pkg/mod/github.com/terraform-linters/tflint-plugin-sdk@v0.21.0/plugin/internal/interceptor/logging.go:16 +0x2bc
  github.com/terraform-linters/tflint-plugin-sdk/plugin/internal/proto._Runner_GetModuleContent_Handler()
      /go/pkg/mod/github.com/terraform-linters/tflint-plugin-sdk@v0.21.0/plugin/internal/proto/tflint_grpc.pb.go:634 +0x1f3
  google.golang.org/grpc.(*Server).processUnaryRPC()
      /go/pkg/mod/google.golang.org/grpc@v1.65.0/server.go:1379 +0x1a2c
  google.golang.org/grpc.(*Server).handleStream()
      /go/pkg/mod/google.golang.org/grpc@v1.65.0/server.go:1790 +0x1824
  google.golang.org/grpc.(*Server).serveStreams.func2.1()
      /go/pkg/mod/google.golang.org/grpc@v1.65.0/server.go:1029 +0x158

Previous write at 0x00c0005d7770 by goroutine 319:
  runtime.mapassign_faststr()
      /usr/local/go/src/runtime/map_faststr.go:203 +0x0
  github.com/terraform-linters/tflint/terraform.(*CallStack).Push()
      /workspaces/tflint/terraform/evaluator.go:49 +0x515
  github.com/terraform-linters/tflint/terraform.(*evaluationData).GetLocalValue()
      /workspaces/tflint/terraform/evaluator.go:260 +0x3f7
  github.com/terraform-linters/tflint/terraform/lang.(*Scope).evalContext()
      /workspaces/tflint/terraform/lang/eval.go:171 +0x1242
  github.com/terraform-linters/tflint/terraform/lang.(*Scope).EvalContext()
      /workspaces/tflint/terraform/lang/eval.go:92 +0x344
  github.com/terraform-linters/tflint/terraform/lang.(*Scope).ExpandBlock()
      /workspaces/tflint/terraform/lang/eval.go:33 +0x302
  github.com/terraform-linters/tflint/terraform.(*Evaluator).ExpandBlock()
      /workspaces/tflint/terraform/evaluator.go:101 +0x1bb
  github.com/terraform-linters/tflint/terraform.(*Module).PartialContent()
      /workspaces/tflint/terraform/module.go:132 +0x204
  github.com/terraform-linters/tflint/plugin.(*GRPCServer).GetModuleContent()
      /workspaces/tflint/plugin/server.go:70 +0x214
  github.com/terraform-linters/tflint-plugin-sdk/plugin/internal/plugin2host.(*GRPCServer).GetModuleContent()
      /go/pkg/mod/github.com/terraform-linters/tflint-plugin-sdk@v0.21.0/plugin/internal/plugin2host/server.go:62 +0x130
  github.com/terraform-linters/tflint-plugin-sdk/plugin/internal/proto._Runner_GetModuleContent_Handler.func1()
      /go/pkg/mod/github.com/terraform-linters/tflint-plugin-sdk@v0.21.0/plugin/internal/proto/tflint_grpc.pb.go:632 +0xbe
  github.com/terraform-linters/tflint-plugin-sdk/plugin/internal/host2plugin.(*GRPCClient).Check.func1.RequestLogging.1()
      /go/pkg/mod/github.com/terraform-linters/tflint-plugin-sdk@v0.21.0/plugin/internal/interceptor/logging.go:16 +0x2bc
  github.com/terraform-linters/tflint-plugin-sdk/plugin/internal/proto._Runner_GetModuleContent_Handler()
      /go/pkg/mod/github.com/terraform-linters/tflint-plugin-sdk@v0.21.0/plugin/internal/proto/tflint_grpc.pb.go:634 +0x1f3
  google.golang.org/grpc.(*Server).processUnaryRPC()
      /go/pkg/mod/google.golang.org/grpc@v1.65.0/server.go:1379 +0x1a2c
  google.golang.org/grpc.(*Server).handleStream()
      /go/pkg/mod/google.golang.org/grpc@v1.65.0/server.go:1790 +0x1824
  google.golang.org/grpc.(*Server).serveStreams.func2.1()
      /go/pkg/mod/google.golang.org/grpc@v1.65.0/server.go:1029 +0x158

Goroutine 320 (running) created at:
  google.golang.org/grpc.(*Server).serveStreams.func2()
      /go/pkg/mod/google.golang.org/grpc@v1.65.0/server.go:1040 +0x224
  google.golang.org/grpc/internal/transport.(*http2Server).operateHeaders()
      /go/pkg/mod/google.golang.org/grpc@v1.65.0/internal/transport/http2_server.go:630 +0x3a41
  google.golang.org/grpc/internal/transport.(*http2Server).HandleStreams()
      /go/pkg/mod/google.golang.org/grpc@v1.65.0/internal/transport/http2_server.go:671 +0x406
  google.golang.org/grpc.(*Server).serveStreams()
      /go/pkg/mod/google.golang.org/grpc@v1.65.0/server.go:1023 +0x69b
  google.golang.org/grpc.(*Server).handleRawConn.func1()
      /go/pkg/mod/google.golang.org/grpc@v1.65.0/server.go:959 +0x86

Goroutine 319 (running) created at:
  google.golang.org/grpc.(*Server).serveStreams.func2()
      /go/pkg/mod/google.golang.org/grpc@v1.65.0/server.go:1040 +0x224
  google.golang.org/grpc/internal/transport.(*http2Server).operateHeaders()
      /go/pkg/mod/google.golang.org/grpc@v1.65.0/internal/transport/http2_server.go:630 +0x3a41
  google.golang.org/grpc/internal/transport.(*http2Server).HandleStreams()
      /go/pkg/mod/google.golang.org/grpc@v1.65.0/internal/transport/http2_server.go:671 +0x406
  google.golang.org/grpc.(*Server).serveStreams()
      /go/pkg/mod/google.golang.org/grpc@v1.65.0/server.go:1023 +0x69b
  google.golang.org/grpc.(*Server).handleRawConn.func1()
      /go/pkg/mod/google.golang.org/grpc@v1.65.0/server.go:959 +0x86
==================
==================
WARNING: DATA RACE
Read at 0x00c00052e090 by goroutine 320:
  github.com/terraform-linters/tflint/terraform.(*CallStack).Push()
      /workspaces/tflint/terraform/evaluator.go:39 +0x22a
  github.com/terraform-linters/tflint/terraform.(*evaluationData).GetLocalValue()
      /workspaces/tflint/terraform/evaluator.go:260 +0x3f7
  github.com/terraform-linters/tflint/terraform/lang.(*Scope).evalContext()
      /workspaces/tflint/terraform/lang/eval.go:171 +0x1242
  github.com/terraform-linters/tflint/terraform/lang.(*Scope).EvalContext()
      /workspaces/tflint/terraform/lang/eval.go:92 +0x344
  github.com/terraform-linters/tflint/terraform/lang.(*Scope).ExpandBlock()
      /workspaces/tflint/terraform/lang/eval.go:33 +0x302
  github.com/terraform-linters/tflint/terraform.(*Evaluator).ExpandBlock()
      /workspaces/tflint/terraform/evaluator.go:101 +0x1bb
  github.com/terraform-linters/tflint/terraform.(*Module).PartialContent()
      /workspaces/tflint/terraform/module.go:132 +0x204
  github.com/terraform-linters/tflint/plugin.(*GRPCServer).GetModuleContent()
      /workspaces/tflint/plugin/server.go:70 +0x214
  github.com/terraform-linters/tflint-plugin-sdk/plugin/internal/plugin2host.(*GRPCServer).GetModuleContent()
      /go/pkg/mod/github.com/terraform-linters/tflint-plugin-sdk@v0.21.0/plugin/internal/plugin2host/server.go:62 +0x130
  github.com/terraform-linters/tflint-plugin-sdk/plugin/internal/proto._Runner_GetModuleContent_Handler.func1()
      /go/pkg/mod/github.com/terraform-linters/tflint-plugin-sdk@v0.21.0/plugin/internal/proto/tflint_grpc.pb.go:632 +0xbe
  github.com/terraform-linters/tflint-plugin-sdk/plugin/internal/host2plugin.(*GRPCClient).Check.func1.RequestLogging.1()
      /go/pkg/mod/github.com/terraform-linters/tflint-plugin-sdk@v0.21.0/plugin/internal/interceptor/logging.go:16 +0x2bc
  github.com/terraform-linters/tflint-plugin-sdk/plugin/internal/proto._Runner_GetModuleContent_Handler()
      /go/pkg/mod/github.com/terraform-linters/tflint-plugin-sdk@v0.21.0/plugin/internal/proto/tflint_grpc.pb.go:634 +0x1f3
  google.golang.org/grpc.(*Server).processUnaryRPC()
      /go/pkg/mod/google.golang.org/grpc@v1.65.0/server.go:1379 +0x1a2c
  google.golang.org/grpc.(*Server).handleStream()
      /go/pkg/mod/google.golang.org/grpc@v1.65.0/server.go:1790 +0x1824
  google.golang.org/grpc.(*Server).serveStreams.func2.1()
      /go/pkg/mod/google.golang.org/grpc@v1.65.0/server.go:1029 +0x158

Previous write at 0x00c00052e090 by goroutine 319:
  github.com/terraform-linters/tflint/terraform.(*CallStack).Push()
      /workspaces/tflint/terraform/evaluator.go:49 +0x526
  github.com/terraform-linters/tflint/terraform.(*evaluationData).GetLocalValue()
      /workspaces/tflint/terraform/evaluator.go:260 +0x3f7
  github.com/terraform-linters/tflint/terraform/lang.(*Scope).evalContext()
      /workspaces/tflint/terraform/lang/eval.go:171 +0x1242
  github.com/terraform-linters/tflint/terraform/lang.(*Scope).EvalContext()
      /workspaces/tflint/terraform/lang/eval.go:92 +0x344
  github.com/terraform-linters/tflint/terraform/lang.(*Scope).ExpandBlock()
      /workspaces/tflint/terraform/lang/eval.go:33 +0x302
  github.com/terraform-linters/tflint/terraform.(*Evaluator).ExpandBlock()
      /workspaces/tflint/terraform/evaluator.go:101 +0x1bb
  github.com/terraform-linters/tflint/terraform.(*Module).PartialContent()
      /workspaces/tflint/terraform/module.go:132 +0x204
  github.com/terraform-linters/tflint/plugin.(*GRPCServer).GetModuleContent()
      /workspaces/tflint/plugin/server.go:70 +0x214
  github.com/terraform-linters/tflint-plugin-sdk/plugin/internal/plugin2host.(*GRPCServer).GetModuleContent()
      /go/pkg/mod/github.com/terraform-linters/tflint-plugin-sdk@v0.21.0/plugin/internal/plugin2host/server.go:62 +0x130
  github.com/terraform-linters/tflint-plugin-sdk/plugin/internal/proto._Runner_GetModuleContent_Handler.func1()
      /go/pkg/mod/github.com/terraform-linters/tflint-plugin-sdk@v0.21.0/plugin/internal/proto/tflint_grpc.pb.go:632 +0xbe
  github.com/terraform-linters/tflint-plugin-sdk/plugin/internal/host2plugin.(*GRPCClient).Check.func1.RequestLogging.1()
      /go/pkg/mod/github.com/terraform-linters/tflint-plugin-sdk@v0.21.0/plugin/internal/interceptor/logging.go:16 +0x2bc
  github.com/terraform-linters/tflint-plugin-sdk/plugin/internal/proto._Runner_GetModuleContent_Handler()
      /go/pkg/mod/github.com/terraform-linters/tflint-plugin-sdk@v0.21.0/plugin/internal/proto/tflint_grpc.pb.go:634 +0x1f3
  google.golang.org/grpc.(*Server).processUnaryRPC()
      /go/pkg/mod/google.golang.org/grpc@v1.65.0/server.go:1379 +0x1a2c
  google.golang.org/grpc.(*Server).handleStream()
      /go/pkg/mod/google.golang.org/grpc@v1.65.0/server.go:1790 +0x1824
  google.golang.org/grpc.(*Server).serveStreams.func2.1()
      /go/pkg/mod/google.golang.org/grpc@v1.65.0/server.go:1029 +0x158

Goroutine 320 (running) created at:
  google.golang.org/grpc.(*Server).serveStreams.func2()
      /go/pkg/mod/google.golang.org/grpc@v1.65.0/server.go:1040 +0x224
  google.golang.org/grpc/internal/transport.(*http2Server).operateHeaders()
      /go/pkg/mod/google.golang.org/grpc@v1.65.0/internal/transport/http2_server.go:630 +0x3a41
  google.golang.org/grpc/internal/transport.(*http2Server).HandleStreams()
      /go/pkg/mod/google.golang.org/grpc@v1.65.0/internal/transport/http2_server.go:671 +0x406
  google.golang.org/grpc.(*Server).serveStreams()
      /go/pkg/mod/google.golang.org/grpc@v1.65.0/server.go:1023 +0x69b
  google.golang.org/grpc.(*Server).handleRawConn.func1()
      /go/pkg/mod/google.golang.org/grpc@v1.65.0/server.go:959 +0x86

Goroutine 319 (running) created at:
  google.golang.org/grpc.(*Server).serveStreams.func2()
      /go/pkg/mod/google.golang.org/grpc@v1.65.0/server.go:1040 +0x224
  google.golang.org/grpc/internal/transport.(*http2Server).operateHeaders()
      /go/pkg/mod/google.golang.org/grpc@v1.65.0/internal/transport/http2_server.go:630 +0x3a41
  google.golang.org/grpc/internal/transport.(*http2Server).HandleStreams()
      /go/pkg/mod/google.golang.org/grpc@v1.65.0/internal/transport/http2_server.go:671 +0x406
  google.golang.org/grpc.(*Server).serveStreams()
      /go/pkg/mod/google.golang.org/grpc@v1.65.0/server.go:1023 +0x69b
  google.golang.org/grpc.(*Server).handleRawConn.func1()
      /go/pkg/mod/google.golang.org/grpc@v1.65.0/server.go:959 +0x86
==================
==================
WARNING: DATA RACE
Read at 0x00c000514868 by goroutine 319:
  github.com/terraform-linters/tflint/terraform.(*CallStack).Empty()
      /workspaces/tflint/terraform/evaluator.go:68 +0x644
  github.com/terraform-linters/tflint/terraform.(*CallStack).Pop()
      /workspaces/tflint/terraform/evaluator.go:54 +0x652
  github.com/terraform-linters/tflint/terraform.(*evaluationData).GetLocalValue()
      /workspaces/tflint/terraform/evaluator.go:266 +0x5ea
  github.com/terraform-linters/tflint/terraform/lang.(*Scope).evalContext()
      /workspaces/tflint/terraform/lang/eval.go:171 +0x1242
  github.com/terraform-linters/tflint/terraform/lang.(*Scope).EvalContext()
      /workspaces/tflint/terraform/lang/eval.go:92 +0x344
  github.com/terraform-linters/tflint/terraform/lang.(*Scope).ExpandBlock()
      /workspaces/tflint/terraform/lang/eval.go:33 +0x302
  github.com/terraform-linters/tflint/terraform.(*Evaluator).ExpandBlock()
      /workspaces/tflint/terraform/evaluator.go:101 +0x1bb
  github.com/terraform-linters/tflint/terraform.(*Module).PartialContent()
      /workspaces/tflint/terraform/module.go:132 +0x204
  github.com/terraform-linters/tflint/plugin.(*GRPCServer).GetModuleContent()
      /workspaces/tflint/plugin/server.go:70 +0x214
  github.com/terraform-linters/tflint-plugin-sdk/plugin/internal/plugin2host.(*GRPCServer).GetModuleContent()
      /go/pkg/mod/github.com/terraform-linters/tflint-plugin-sdk@v0.21.0/plugin/internal/plugin2host/server.go:62 +0x130
  github.com/terraform-linters/tflint-plugin-sdk/plugin/internal/proto._Runner_GetModuleContent_Handler.func1()
      /go/pkg/mod/github.com/terraform-linters/tflint-plugin-sdk@v0.21.0/plugin/internal/proto/tflint_grpc.pb.go:632 +0xbe
  github.com/terraform-linters/tflint-plugin-sdk/plugin/internal/host2plugin.(*GRPCClient).Check.func1.RequestLogging.1()
      /go/pkg/mod/github.com/terraform-linters/tflint-plugin-sdk@v0.21.0/plugin/internal/interceptor/logging.go:16 +0x2bc
  github.com/terraform-linters/tflint-plugin-sdk/plugin/internal/proto._Runner_GetModuleContent_Handler()
      /go/pkg/mod/github.com/terraform-linters/tflint-plugin-sdk@v0.21.0/plugin/internal/proto/tflint_grpc.pb.go:634 +0x1f3
  google.golang.org/grpc.(*Server).processUnaryRPC()
      /go/pkg/mod/google.golang.org/grpc@v1.65.0/server.go:1379 +0x1a2c
  google.golang.org/grpc.(*Server).handleStream()
      /go/pkg/mod/google.golang.org/grpc@v1.65.0/server.go:1790 +0x1824
  google.golang.org/grpc.(*Server).serveStreams.func2.1()
      /go/pkg/mod/google.golang.org/grpc@v1.65.0/server.go:1029 +0x158

Previous write at 0x00c000514868 by goroutine 320:
  github.com/terraform-linters/tflint/terraform.(*CallStack).Push()
      /workspaces/tflint/terraform/evaluator.go:37 +0x130
  github.com/terraform-linters/tflint/terraform.(*evaluationData).GetLocalValue()
      /workspaces/tflint/terraform/evaluator.go:260 +0x3f7
  github.com/terraform-linters/tflint/terraform/lang.(*Scope).evalContext()
      /workspaces/tflint/terraform/lang/eval.go:171 +0x1242
  github.com/terraform-linters/tflint/terraform/lang.(*Scope).EvalContext()
      /workspaces/tflint/terraform/lang/eval.go:92 +0x344
  github.com/terraform-linters/tflint/terraform/lang.(*Scope).ExpandBlock()
      /workspaces/tflint/terraform/lang/eval.go:33 +0x302
  github.com/terraform-linters/tflint/terraform.(*Evaluator).ExpandBlock()
      /workspaces/tflint/terraform/evaluator.go:101 +0x1bb
  github.com/terraform-linters/tflint/terraform.(*Module).PartialContent()
      /workspaces/tflint/terraform/module.go:132 +0x204
  github.com/terraform-linters/tflint/plugin.(*GRPCServer).GetModuleContent()
      /workspaces/tflint/plugin/server.go:70 +0x214
  github.com/terraform-linters/tflint-plugin-sdk/plugin/internal/plugin2host.(*GRPCServer).GetModuleContent()
      /go/pkg/mod/github.com/terraform-linters/tflint-plugin-sdk@v0.21.0/plugin/internal/plugin2host/server.go:62 +0x130
  github.com/terraform-linters/tflint-plugin-sdk/plugin/internal/proto._Runner_GetModuleContent_Handler.func1()
      /go/pkg/mod/github.com/terraform-linters/tflint-plugin-sdk@v0.21.0/plugin/internal/proto/tflint_grpc.pb.go:632 +0xbe
  github.com/terraform-linters/tflint-plugin-sdk/plugin/internal/host2plugin.(*GRPCClient).Check.func1.RequestLogging.1()
      /go/pkg/mod/github.com/terraform-linters/tflint-plugin-sdk@v0.21.0/plugin/internal/interceptor/logging.go:16 +0x2bc
  github.com/terraform-linters/tflint-plugin-sdk/plugin/internal/proto._Runner_GetModuleContent_Handler()
      /go/pkg/mod/github.com/terraform-linters/tflint-plugin-sdk@v0.21.0/plugin/internal/proto/tflint_grpc.pb.go:634 +0x1f3
  google.golang.org/grpc.(*Server).processUnaryRPC()
      /go/pkg/mod/google.golang.org/grpc@v1.65.0/server.go:1379 +0x1a2c
  google.golang.org/grpc.(*Server).handleStream()
      /go/pkg/mod/google.golang.org/grpc@v1.65.0/server.go:1790 +0x1824
  google.golang.org/grpc.(*Server).serveStreams.func2.1()
      /go/pkg/mod/google.golang.org/grpc@v1.65.0/server.go:1029 +0x158

Goroutine 319 (running) created at:
  google.golang.org/grpc.(*Server).serveStreams.func2()
      /go/pkg/mod/google.golang.org/grpc@v1.65.0/server.go:1040 +0x224
  google.golang.org/grpc/internal/transport.(*http2Server).operateHeaders()
      /go/pkg/mod/google.golang.org/grpc@v1.65.0/internal/transport/http2_server.go:630 +0x3a41
  google.golang.org/grpc/internal/transport.(*http2Server).HandleStreams()
      /go/pkg/mod/google.golang.org/grpc@v1.65.0/internal/transport/http2_server.go:671 +0x406
  google.golang.org/grpc.(*Server).serveStreams()
      /go/pkg/mod/google.golang.org/grpc@v1.65.0/server.go:1023 +0x69b
  google.golang.org/grpc.(*Server).handleRawConn.func1()
      /go/pkg/mod/google.golang.org/grpc@v1.65.0/server.go:959 +0x86

Goroutine 320 (running) created at:
  google.golang.org/grpc.(*Server).serveStreams.func2()
      /go/pkg/mod/google.golang.org/grpc@v1.65.0/server.go:1040 +0x224
  google.golang.org/grpc/internal/transport.(*http2Server).operateHeaders()
      /go/pkg/mod/google.golang.org/grpc@v1.65.0/internal/transport/http2_server.go:630 +0x3a41
  google.golang.org/grpc/internal/transport.(*http2Server).HandleStreams()
      /go/pkg/mod/google.golang.org/grpc@v1.65.0/internal/transport/http2_server.go:671 +0x406
  google.golang.org/grpc.(*Server).serveStreams()
      /go/pkg/mod/google.golang.org/grpc@v1.65.0/server.go:1023 +0x69b
  google.golang.org/grpc.(*Server).handleRawConn.func1()
      /go/pkg/mod/google.golang.org/grpc@v1.65.0/server.go:959 +0x86
==================
==================
WARNING: DATA RACE
Read at 0x00c0007b7410 by goroutine 319:
  github.com/terraform-linters/tflint/terraform.(*CallStack).Pop()
      /workspaces/tflint/terraform/evaluator.go:58 +0x6cc
  github.com/terraform-linters/tflint/terraform.(*evaluationData).GetLocalValue()
      /workspaces/tflint/terraform/evaluator.go:266 +0x5ea
  github.com/terraform-linters/tflint/terraform/lang.(*Scope).evalContext()
      /workspaces/tflint/terraform/lang/eval.go:171 +0x1242
  github.com/terraform-linters/tflint/terraform/lang.(*Scope).EvalContext()
      /workspaces/tflint/terraform/lang/eval.go:92 +0x344
  github.com/terraform-linters/tflint/terraform/lang.(*Scope).ExpandBlock()
      /workspaces/tflint/terraform/lang/eval.go:33 +0x302
  github.com/terraform-linters/tflint/terraform.(*Evaluator).ExpandBlock()
      /workspaces/tflint/terraform/evaluator.go:101 +0x1bb
  github.com/terraform-linters/tflint/terraform.(*Module).PartialContent()
      /workspaces/tflint/terraform/module.go:132 +0x204
  github.com/terraform-linters/tflint/plugin.(*GRPCServer).GetModuleContent()
      /workspaces/tflint/plugin/server.go:70 +0x214
  github.com/terraform-linters/tflint-plugin-sdk/plugin/internal/plugin2host.(*GRPCServer).GetModuleContent()
      /go/pkg/mod/github.com/terraform-linters/tflint-plugin-sdk@v0.21.0/plugin/internal/plugin2host/server.go:62 +0x130
  github.com/terraform-linters/tflint-plugin-sdk/plugin/internal/proto._Runner_GetModuleContent_Handler.func1()
      /go/pkg/mod/github.com/terraform-linters/tflint-plugin-sdk@v0.21.0/plugin/internal/proto/tflint_grpc.pb.go:632 +0xbe
  github.com/terraform-linters/tflint-plugin-sdk/plugin/internal/host2plugin.(*GRPCClient).Check.func1.RequestLogging.1()
      /go/pkg/mod/github.com/terraform-linters/tflint-plugin-sdk@v0.21.0/plugin/internal/interceptor/logging.go:16 +0x2bc
  github.com/terraform-linters/tflint-plugin-sdk/plugin/internal/proto._Runner_GetModuleContent_Handler()
      /go/pkg/mod/github.com/terraform-linters/tflint-plugin-sdk@v0.21.0/plugin/internal/proto/tflint_grpc.pb.go:634 +0x1f3
  google.golang.org/grpc.(*Server).processUnaryRPC()
      /go/pkg/mod/google.golang.org/grpc@v1.65.0/server.go:1379 +0x1a2c
  google.golang.org/grpc.(*Server).handleStream()
      /go/pkg/mod/google.golang.org/grpc@v1.65.0/server.go:1790 +0x1824
  google.golang.org/grpc.(*Server).serveStreams.func2.1()
      /go/pkg/mod/google.golang.org/grpc@v1.65.0/server.go:1029 +0x158

Previous write at 0x00c0007b7410 by goroutine 320:
  github.com/terraform-linters/tflint/terraform.(*CallStack).Push()
      /workspaces/tflint/terraform/evaluator.go:37 +0xdd
  github.com/terraform-linters/tflint/terraform.(*evaluationData).GetLocalValue()
      /workspaces/tflint/terraform/evaluator.go:260 +0x3f7
  github.com/terraform-linters/tflint/terraform/lang.(*Scope).evalContext()
      /workspaces/tflint/terraform/lang/eval.go:171 +0x1242
  github.com/terraform-linters/tflint/terraform/lang.(*Scope).EvalContext()
      /workspaces/tflint/terraform/lang/eval.go:92 +0x344
  github.com/terraform-linters/tflint/terraform/lang.(*Scope).ExpandBlock()
      /workspaces/tflint/terraform/lang/eval.go:33 +0x302
  github.com/terraform-linters/tflint/terraform.(*Evaluator).ExpandBlock()
      /workspaces/tflint/terraform/evaluator.go:101 +0x1bb
  github.com/terraform-linters/tflint/terraform.(*Module).PartialContent()
      /workspaces/tflint/terraform/module.go:132 +0x204
  github.com/terraform-linters/tflint/plugin.(*GRPCServer).GetModuleContent()
      /workspaces/tflint/plugin/server.go:70 +0x214
  github.com/terraform-linters/tflint-plugin-sdk/plugin/internal/plugin2host.(*GRPCServer).GetModuleContent()
      /go/pkg/mod/github.com/terraform-linters/tflint-plugin-sdk@v0.21.0/plugin/internal/plugin2host/server.go:62 +0x130
  github.com/terraform-linters/tflint-plugin-sdk/plugin/internal/proto._Runner_GetModuleContent_Handler.func1()
      /go/pkg/mod/github.com/terraform-linters/tflint-plugin-sdk@v0.21.0/plugin/internal/proto/tflint_grpc.pb.go:632 +0xbe
  github.com/terraform-linters/tflint-plugin-sdk/plugin/internal/host2plugin.(*GRPCClient).Check.func1.RequestLogging.1()
      /go/pkg/mod/github.com/terraform-linters/tflint-plugin-sdk@v0.21.0/plugin/internal/interceptor/logging.go:16 +0x2bc
  github.com/terraform-linters/tflint-plugin-sdk/plugin/internal/proto._Runner_GetModuleContent_Handler()
      /go/pkg/mod/github.com/terraform-linters/tflint-plugin-sdk@v0.21.0/plugin/internal/proto/tflint_grpc.pb.go:634 +0x1f3
  google.golang.org/grpc.(*Server).processUnaryRPC()
      /go/pkg/mod/google.golang.org/grpc@v1.65.0/server.go:1379 +0x1a2c
  google.golang.org/grpc.(*Server).handleStream()
      /go/pkg/mod/google.golang.org/grpc@v1.65.0/server.go:1790 +0x1824
  google.golang.org/grpc.(*Server).serveStreams.func2.1()
      /go/pkg/mod/google.golang.org/grpc@v1.65.0/server.go:1029 +0x158

Goroutine 319 (running) created at:
  google.golang.org/grpc.(*Server).serveStreams.func2()
      /go/pkg/mod/google.golang.org/grpc@v1.65.0/server.go:1040 +0x224
  google.golang.org/grpc/internal/transport.(*http2Server).operateHeaders()
      /go/pkg/mod/google.golang.org/grpc@v1.65.0/internal/transport/http2_server.go:630 +0x3a41
  google.golang.org/grpc/internal/transport.(*http2Server).HandleStreams()
      /go/pkg/mod/google.golang.org/grpc@v1.65.0/internal/transport/http2_server.go:671 +0x406
  google.golang.org/grpc.(*Server).serveStreams()
      /go/pkg/mod/google.golang.org/grpc@v1.65.0/server.go:1023 +0x69b
  google.golang.org/grpc.(*Server).handleRawConn.func1()
      /go/pkg/mod/google.golang.org/grpc@v1.65.0/server.go:959 +0x86

Goroutine 320 (running) created at:
  google.golang.org/grpc.(*Server).serveStreams.func2()
      /go/pkg/mod/google.golang.org/grpc@v1.65.0/server.go:1040 +0x224
  google.golang.org/grpc/internal/transport.(*http2Server).operateHeaders()
      /go/pkg/mod/google.golang.org/grpc@v1.65.0/internal/transport/http2_server.go:630 +0x3a41
  google.golang.org/grpc/internal/transport.(*http2Server).HandleStreams()
      /go/pkg/mod/google.golang.org/grpc@v1.65.0/internal/transport/http2_server.go:671 +0x406
  google.golang.org/grpc.(*Server).serveStreams()
      /go/pkg/mod/google.golang.org/grpc@v1.65.0/server.go:1023 +0x69b
  google.golang.org/grpc.(*Server).handleRawConn.func1()
      /go/pkg/mod/google.golang.org/grpc@v1.65.0/server.go:959 +0x86
==================
Failed to check ruleset; main.tf:6,13-29: circular reference found; local.project_id -> local.project_id

As can be seen from the output, this seems to be caused by non-goroutine-safe operations on the CallStack.

// Build a call stack for circular reference detection only when getting a local value.
if diags := d.Evaluator.CallStack.Push(addrs.Reference{Subject: addr, SourceRange: rng}); diags.HasErrors() {
return cty.UnknownVal(cty.DynamicPseudoType), diags
}
val, diags := d.Evaluator.EvaluateExpr(config.Expr, cty.DynamicPseudoType)
d.Evaluator.CallStack.Pop()

My initial assumption was that it would be safe to run parallel checks on child modules because each module has its own Runner, but the deep checking feature is evaluated against the root module, so they may be operated simultaneously by multiple module runners.

To fix this bug, we would need to either clone the root module for each child module, or rewrite the implementation with side effects like call stacks.

@stephanschielke
Copy link
Author

Thanks for the quick response.

Indeed, the deep_check settings of the tflint-ruleset-google in combination with parallel-runners are the root cause. Luckily, there is a hotfix by either disabling the deep check or the parallel-runners.

Unfortunately, there is not much documentation on the deep_check feature. All I know is it slows down the linting significantly, so I would be mindful when introducing the cloning of the root module for each child module since it sounds like an additional cost.

From my perspective, I can live with the hotfix.

@mikeatzillowgroup
Copy link

We're seeing this in tflint-ruleset-aws as well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging a pull request may close this issue.

3 participants