terraform-linters / tflint

A Pluggable Terraform Linter
Mozilla Public License 2.0
4.86k stars 354 forks source link

TFLint docker bundle crashing on v0.36.1 due to `Panic: reflect: call of reflect.Value.IsNil on zero Value` #1375

Closed moogzy closed 2 years ago

moogzy commented 2 years ago

Docker bundle is crashing on a terraform manifest that lints perfectly fine on the previous tflint version.

Crashing version: v0.36.1.0

When pinning the version to v.0.35.0.1 the linter does not crash with the error shown below.

2022-05-06 01:20:21 AWST | Panic: reflect: call of reflect.Value.IsNil on zero Value
-- | --
  | 2022-05-06 01:20:21 AWST | -> 0: main.main.func1: /main.go(21)
  | 2022-05-06 01:20:21 AWST | -> 1: runtime.gopanic: /panic.go(838)
  | 2022-05-06 01:20:21 AWST | -> 2: reflect.Value.IsNil: /value.go(1506)
  | 2022-05-06 01:20:21 AWST | -> 3: github.com/terraform-linters/tflint-plugin-sdk/hclext.Content: /structure.go(54)
  | 2022-05-06 01:20:21 AWST | -> 4: github.com/terraform-linters/tflint/tflint.(*PluginConfig).Content: /config.go(338)
  | 2022-05-06 01:20:21 AWST | -> 5: github.com/terraform-linters/tflint/cmd.(*CLI).inspect: /inspect.go(69)
  | 2022-05-06 01:20:21 AWST | -> 6: github.com/terraform-linters/tflint/cmd.(*CLI).Run: /cli.go(101)
  | 2022-05-06 01:20:21 AWST | -> 7: main.main: /main.go(34)
  | 2022-05-06 01:20:21 AWST | -> 8: runtime.main: /proc.go(250)
  | 2022-05-06 01:20:21 AWST | -> 9: runtime.goexit: /asm_amd64.s(1571)

The bundle is running in our CI environment. Nothing else has changed. The manifest file is simple one with Datadog monitors defined. No changes made to the manifest when pinning tflint to v.0.35.0.1 which resolved the panic issue.

Command run: tflint --enable-plugin=aws

Let me know if you want an example file.

Version

Example:

$ tflint -v
TFLint version 0.36.1
$ terraform -v
Terraform v1.1.9
moogzy commented 2 years ago

@wata727 it looks like you bumped the version to v0.36.1.0 ~2 hours ago. Could you look into this please?

Version bump: https://github.com/terraform-linters/tflint-bundle/pull/24

Maybe the AWS ruleset change is broken? Might be worth rolling back the version?

wata727 commented 2 years ago

Thank you for reporting this. This is a bug on the TFLint side. This bug is fixed in v0.36.2, and released tflint-bundle v0.36.2.0.