-
Notifications
You must be signed in to change notification settings - Fork 377
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
Comments
Thank you for your detailed report. 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
As can be seen from the output, this seems to be caused by non-goroutine-safe operations on the Lines 259 to 266 in a7ebc9b
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. |
Thanks for the quick response. Indeed, the Unfortunately, there is not much documentation on the From my perspective, I can live with the hotfix. |
We're seeing this in tflint-ruleset-aws as well |
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:
My main.tf looks like this:
The local is stored in a
variables.tf
file:Here are my rulesets and
tflint
version:Command
tflint --recursive --config "$(pwd)/.tflint.hcl"
Terraform Configuration
TFLint Configuration
Output
TFLint Version
0.52.0
Terraform Version
1.9.3
Operating System
The text was updated successfully, but these errors were encountered: