terraform-linters / tflint

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

Rule not found for rules of plugins #1028

Closed syphernl closed 3 years ago

syphernl commented 3 years ago

With TFLint < 0.23 we had a few rules disabled for our Terraform modules such as:

rule "aws_instance_invalid_ami" {
  enabled = false
}

This worked fine until we upgraded to TFLint 0.23.0 which required us to changed to use the plugin instead, which we did.

config {
  module = true
  force = false
}

plugin "aws" {
  enabled = true
  deep_check = true
}

After upgrading however TFLint started complaining that his rule does not exist.

Failed to check rule config. An error occurred:

Error: Rule not found: aws_instance_invalid_ami

Version

❯ tflint -v
TFLint version 0.23.0
+ ruleset.aws (0.1.1-bundled)

❯ terraform -v
Terraform v0.13.5
stfsy commented 3 years ago

I'm using superlinter to lint .tf files with tflint. My builds fail too, error message seems identical.

Error: Rule not found: aws_instance_invalid_type]
2021-01-06 11:03:27 [INFO]   ---------------------------
2021-01-06 11:03:27 [INFO]   File:[/github/workspace/blauspecht-infrastructure/frontend/green/output.tf]
2021-01-06 11:03:27 [ERROR]   Found errors in [tflint] linter!
2021-01-06 11:03:27 [ERROR]   Error code: 2. Command output:[Failed to check rule config. An error occurred:

Error: Rule not found: aws_instance_invalid_type]
2021-01-06 11:03:27 [INFO]   ---------------------------
2021-01-06 11:03:27 [INFO]   File:[/github/workspace/blauspecht-infrastructure/frontend/template/main.tf]
2021-01-06 11:03:27 [ERROR]   Found errors in [tflint] linter!
2021-01-06 11:03:27 [ERROR]   Error code: 2. Command output:[Failed to check rule config. An error occurred:

I'm not deploying to aws, so i'm even more suprised by this error message.

wata727 commented 3 years ago

@stfsy Oh, maybe this is an issue on superlinter. I'm opening a pull request to change the default config. https://github.com/github/super-linter/pull/1124 I understand that this is an issue where rules that are only enabled during deep checking are always ignored when validating rule names. For non-AWS users, it is the intended behavior that the aws_instance_invalid_type rule is not available.