@@ -28,7 +28,6 @@ import (
2828 "github.com/gruntwork-io/terragrunt/options"
2929 "github.com/gruntwork-io/terragrunt/pkg/log"
3030 "github.com/hashicorp/hcl/v2"
31- "github.com/mattn/go-zglob"
3231 "github.com/zclconf/go-cty/cty"
3332 "golang.org/x/sync/errgroup"
3433)
@@ -77,9 +76,6 @@ type Discovery struct {
7776
7877 graphTarget string
7978
80- // includeDirs is a list of directory patterns to include in discovery (for strict include mode).
81- includeDirs []string
82-
8379 // configFilenames is the list of config filenames to discover. If nil, defaults are used.
8480 configFilenames []string
8581
@@ -236,12 +232,6 @@ func (d *Discovery) WithConfigFilenames(filenames []string) *Discovery {
236232 return d
237233}
238234
239- // WithIncludeDirs sets include directory glob patterns used for filtering during discovery.
240- func (d * Discovery ) WithIncludeDirs (dirs []string ) * Discovery {
241- d .includeDirs = dirs
242- return d
243- }
244-
245235// WithParserOptions sets custom HCL parser options to use when parsing during discovery.
246236func (d * Discovery ) WithParserOptions (options []hclparse.Option ) * Discovery {
247237 d .parserOptions = options
@@ -333,32 +323,6 @@ func (d *Discovery) withExcludeByDefault() *Discovery {
333323 return d
334324}
335325
336- // compileIncludePatterns compiles the include directory patterns for faster matching.
337- func (d * Discovery ) compileIncludePatterns (l log.Logger ) {
338- d .compiledIncludePatterns = make ([]CompiledPattern , 0 , len (d .includeDirs ))
339- for _ , pattern := range d .includeDirs {
340- if compiled , err := zglob .New (pattern ); err == nil {
341- d .compiledIncludePatterns = append (d .compiledIncludePatterns , CompiledPattern {
342- Original : pattern ,
343- Compiled : compiled ,
344- })
345- } else {
346- l .Warnf ("Failed to compile include pattern '%s': %v. Pattern will be ignored." , pattern , err )
347- }
348- }
349- }
350-
351- // matchesIncludePath reports whether the provided directory matches any compiled include pattern.
352- func (d * Discovery ) matchesIncludePath (dir string ) bool {
353- for _ , pattern := range d .compiledIncludePatterns {
354- if pattern .Compiled .Match (dir ) {
355- return true
356- }
357- }
358-
359- return false
360- }
361-
362326// String returns a string representation of a Component.
363327// String returns the path of the Component.
364328func String (c component.Component ) string {
@@ -731,11 +695,6 @@ func (d *Discovery) processFile(
731695 // Always allow .terragrunt-stack contents
732696 cleanDir := util .CleanPath (canonicalDir )
733697 allowHidden = isInStackDirectory (cleanDir )
734-
735- if ! allowHidden {
736- // Use a common helper for include matching
737- allowHidden = d .matchesIncludePath (canonicalDir )
738- }
739698 }
740699
741700 if ! allowHidden {
@@ -896,25 +855,6 @@ func (d *Discovery) Discover(
896855 filenames = DefaultConfigFilenames
897856 }
898857
899- // Prepare include/exclude glob patterns (canonicalized) for matching
900- var includePatterns []string
901-
902- if len (d .includeDirs ) > 0 {
903- for _ , p := range d .includeDirs {
904- if ! filepath .IsAbs (p ) {
905- p = filepath .Join (d .discoveryContext .WorkingDir , p )
906- }
907-
908- includePatterns = append (includePatterns , util .CleanPath (p ))
909- }
910- }
911-
912- // Compile patterns if not already compiled
913- if len (d .compiledIncludePatterns ) == 0 && len (includePatterns ) > 0 {
914- d .includeDirs = includePatterns
915- d .compileIncludePatterns (l )
916- }
917-
918858 // Use concurrent discovery for better performance
919859 components , err := d .discoverConcurrently (ctx , l , opts , & hiddenDirMemo {}, filenames )
920860 if err != nil {
0 commit comments