Skip to content

Commit

Permalink
add a valid variable definition file extension to list of exceptions …
Browse files Browse the repository at this point in the history
…(#1331)

* add a valid variable definition file extension to list of exceptions

* run go fmt

Co-authored-by: Matija Burisa <[email protected]>
  • Loading branch information
gek0 and MatijaBurisa authored Jan 4, 2021
1 parent 2ac77db commit 43fce15
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion server/events/project_finder.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ func (p *DefaultProjectFinder) DetermineProjectsViaConfig(log *logging.SimpleLog
// filterToTerraform filters non-terraform files from files.
func (p *DefaultProjectFinder) filterToTerraform(files []string) []string {
var filtered []string
fileNameRe, _ := regexp.Compile(`^.*(\.tf|\.tfvars)$`)
fileNameRe, _ := regexp.Compile(`^.*(\.tf|\.tfvars|\.tfvars.json)$`)

for _, fileName := range files {
if !p.shouldIgnore(fileName) && (fileNameRe.MatchString(fileName) || filepath.Base(fileName) == "terragrunt.hcl") {
Expand Down
5 changes: 4 additions & 1 deletion server/events/project_finder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ func setupTmpRepos(t *testing.T) {
// env/
// staging.tfvars
// production.tfvars
// global-env-config.auto.tfvars.json
envDir, err = ioutil.TempDir("", "")
Ok(t, err)
err = os.MkdirAll(filepath.Join(envDir, "env"), 0700)
Expand Down Expand Up @@ -245,6 +246,7 @@ func TestDefaultProjectFinder_DetermineProjectsViaConfig(t *testing.T) {
// main.tf
// project1/
// main.tf
// terraform.tfvars.json
// project2/
// main.tf
// terraform.tfvars
Expand All @@ -254,7 +256,8 @@ func TestDefaultProjectFinder_DetermineProjectsViaConfig(t *testing.T) {
tmpDir, cleanup := DirStructure(t, map[string]interface{}{
"main.tf": nil,
"project1": map[string]interface{}{
"main.tf": nil,
"main.tf": nil,
"terraform.tfvars.json": nil,
},
"project2": map[string]interface{}{
"main.tf": nil,
Expand Down

0 comments on commit 43fce15

Please sign in to comment.