Skip to content

Commit

Permalink
fix: logic of handling *.tf and *.tf.json in Terraform
Browse files Browse the repository at this point in the history
  • Loading branch information
zdtsw committed Aug 1, 2022
1 parent ccd6f1b commit e1bebdd
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pkg/fanal/analyzer/config/terraform/terraform.go
Expand Up @@ -16,7 +16,8 @@ import (

const version = 1

var requiredExts = []string{".tf", ".tf.json"}
// List of Terraforma file suffix without "."
var requiredExts = []string{"tf", "tf.json"}

type ConfigAnalyzer struct {
filePattern *regexp.Regexp
Expand Down Expand Up @@ -49,7 +50,7 @@ func (a ConfigAnalyzer) Analyze(_ context.Context, input analyzer.AnalysisInput)
}

func (a ConfigAnalyzer) Required(filePath string, _ os.FileInfo) bool {
return slices.Contains(requiredExts, filepath.Ext(filePath))
return slices.Contains(requiredExts, strings.SplitAfterN(filePath, ".", 2))
}

func (ConfigAnalyzer) Type() analyzer.Type {
Expand Down

0 comments on commit e1bebdd

Please sign in to comment.