question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Linting fails under tflint 0.12.0

See original GitHub issue

Given a very simple Terraform config file (not the real GUIDs and such):

provider "azurerm" {
  version         = "=1.35.0"
  subscription_id = "1fb2265c-7cd1-4d4f-bc67-61d7799765e8"
  tenant_id       = "f6586130-34a9-4ba8-917d-f78e55f72733"
}

resource "azurerm_resource_group" "kubernetes" {
  name     = "myrg"
  location = "West US"
}

Running linting (manually, since it doesn’t seem to auto-run?) yields the following error in the output window:

2019-10-08 18:38:54:080 [INFO ] <cmd>lint: undefined issues
2019-10-08 18:38:54:081 [ERROR] <cmd>lint: Linting failed for c:\Users\tillig\Desktop\Terraform TypeError: issues.forEach is not a function

I believe this will be fixed by PR #227

However, if I add something to my config file that would be found by linting, like an unpinned module

provider "azurerm" {
  version         = "=1.35.0"
  subscription_id = "be62f057-87be-48e5-9c5f-c6fc74ac9d19"
  tenant_id       = "a172c77d-91cf-47f0-a813-30aee710c0dc"
}

resource "azurerm_resource_group" "kubernetes" {
  name     = "tillig-k8s"
  location = "West US"
}

module "unpinned" {
  source = "git://hashicorp.com/consul.git"
}

Running linting yields an error:

2019-10-08 18:44:26:069 [ERROR] <cmd>lint: Linting failed for c:\Users\tillig\Desktop\Terraform Error: Command failed: tflint --format json

I am guessing that when the current tflint finds errors it doesn’t exit with 0, it instead appears to exit with 3, so when linting sees any error, it doesn’t even try to parse the results.

It appears you can run tflint /force to require it to always exit 0 even if issues are found. Should that be added to the command line parameters?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:4
  • Comments:13 (4 by maintainers)

github_iconTop GitHub Comments

5reactions
tilligcommented, Nov 1, 2019

@jeffb4 Are you able to do this update or should I fork and submit a new version of the PR? I’d love to see tflint working.

4reactions
aaronsteerscommented, Mar 22, 2020

I’m experiencing this as well with terraform 0.12 - is there nothing which can be done as a workaround to get tflint working in VS Code?

Read more comments on GitHub >

github_iconTop Results From Across the Web

hashicorp/vscode-terraform - Linting fails under tflint 0.12.0
Given a very simple Terraform config file (not the real GUIDs and such): provider "azurerm" { version = "=1.35.0" subscription_id ...
Read more >
How to suppress/ignore tflint warnings - terraform
Is there a way to suppress it? tflint command is getting executed successfully and also showing possible issues/notice in my terraform code. I ......
Read more >
tflint — Homebrew Formulae
tflint. Install command: brew install tflint. Linter for Terraform files. https://github.com/terraform-linters/tflint. License: MPL-2.0.
Read more >
How To Keep Your Terraform Code Clean, The ...
TFLint is a linter checking potential Terraform errors and enforcing best practices. You can add plugins compatible with major cloud providers – AWS,...
Read more >
tflint
TFLint is Terraform linter for detecting errors that can not be detected by ... I'm getting an invalid error running tflint in a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found