Skip to content

Commit

Permalink
Support tflint >=0.47.0 (#351)
Browse files Browse the repository at this point in the history
Adaptation of #350, using `target: ${parent}` to better achieve the
`--chdir` behavior recommended by
terraform-linters/tflint#1687

---------

Co-authored-by: Piotr Roszatycki <[email protected]>
  • Loading branch information
TylerJang27 and dex4er authored Jul 6, 2023
1 parent 097a7d3 commit 29a913b
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 11 deletions.
10 changes: 10 additions & 0 deletions linters/tflint/plugin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,16 @@ lint:
- name: tflint
files: [terraform]
commands:
- name: lint
output: sarif
prepare_run: tflint --init
run: tflint --format=sarif --chdir=${target} --force
success_codes: [0, 1, 2]
read_output_from: stdout
target: ${parent}
run_linter_from: root_directory
run_from_root_target: .tflint.hcl
version: ">=0.47.0"
- name: lint
output: sarif
prepare_run: tflint --init
Expand Down
22 changes: 11 additions & 11 deletions linters/tflint/test_data/tflint_v0.35.0_CUSTOM.check.shot
Original file line number Diff line number Diff line change
@@ -1,43 +1,43 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Testing linter tflint test CUSTOM 1`] = `
Object {
"issues": Array [
Object {
{
"issues": [
{
"code": "aws_instance_invalid_type",
"column": "19",
"file": "aws.tf",
"issueClass": "ISSUE_CLASS_NEW",
"level": "LEVEL_HIGH",
"line": "2",
"linter": "tflint",
"message": "\\"t1.2xlarge\\" is an invalid value as instance_type",
"message": ""t1.2xlarge" is an invalid value as instance_type",
"targetType": "terraform",
},
Object {
{
"code": "aws_instance_previous_type",
"column": "19",
"file": "aws.tf",
"issueClass": "ISSUE_CLASS_NEW",
"level": "LEVEL_MEDIUM",
"line": "2",
"linter": "tflint",
"message": "\\"t1.2xlarge\\" is previous generation instance type.",
"message": ""t1.2xlarge" is previous generation instance type.",
"targetType": "terraform",
},
],
"lintActions": Array [
Object {
"lintActions": [
{
"command": "lint",
"fileGroupName": "terraform",
"linter": "tflint",
"paths": Array [
"paths": [
"aws.tf",
],
"verb": "TRUNK_VERB_CHECK",
},
],
"taskFailures": Array [],
"unformattedFiles": Array [],
"taskFailures": [],
"unformattedFiles": [],
}
`;

0 comments on commit 29a913b

Please sign in to comment.