Skip to content

Commit

Permalink
fix: exclude .terraform directories from checks
Browse files Browse the repository at this point in the history
  • Loading branch information
cterence committed Sep 29, 2023
1 parent 38ceb89 commit 1357675
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions helpers/getters.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ func GetModules() ([]data.TerraformModule, error) {
}
// Check if the path is a file and its name matches "*.tf"
if !info.IsDir() && strings.HasSuffix(info.Name(), ".tf") {
// exclude the files which are in the .terragrunt-cache directory
if !regexp.MustCompile(`.terragrunt-cache`).MatchString(path) {
// exclude the files which are in the .terragrunt-cache or .terraform directory
if !regexp.MustCompile(`.terragrunt-cache|.terraform`).MatchString(path) {
module := data.TerraformModule{FullPath: filepath.Dir(path), Name: filepath.Base(filepath.Dir(path))}
// Check if the module is already in the list
alreadyInList := false
Expand Down Expand Up @@ -57,8 +57,8 @@ func GetLayers() ([]*data.Layer, error) {

// Check if the current path is a file and its name matches "terragrunt.hcl"
if !info.IsDir() && info.Name() == "terragrunt.hcl" {
// exclude the files which are in the .terragrunt-cache directory
if !regexp.MustCompile(`.terragrunt-cache`).MatchString(path) {
// exclude the files which are in the .terragrunt-cache or .terraform directory
if !regexp.MustCompile(`.terragrunt-cache|.terraform`).MatchString(path) {
// TODO: start from the codebase path instead of the relative path
absPath, err := filepath.Abs(path)
if err != nil {
Expand Down

0 comments on commit 1357675

Please sign in to comment.