-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
In the PartialParseConfigFile
function (located in config/config_partial.go
, starting at line 282), there is a call to hclCache.Get(...)
. However, this cache entry is never resolved because there is no corresponding call to hclCache.Put(...)
with the same cache key anywhere in the codebase.
Steps To Reproduce
-
Create multiple
terragrunt.hcl
files that reference the sameroot-terragrunt.hcl
. -
Run Terragrunt.
Expected behavior: root-terragrunt.hcl
should be parsed only once, and subsequent accesses should hit the cache.
Actual behavior: The cache is never hit because the value is never stored -hclCache.Put(...)
is missing.
func PartialParseConfigFile(ctx *ParsingContext, l log.Logger, configPath string, include *IncludeConfig) (*TerragruntConfig, error) {
hclCache := cache.ContextCache[*hclparse.File](ctx, HclCacheContextKey)
fileInfo, err := os.Stat(configPath)
if err != nil {
if os.IsNotExist(err) {
return nil, TerragruntConfigNotFoundError{Path: configPath}
}
return nil, errors.New(err)
}
var (
file *hclparse.File
cacheKey = fmt.Sprintf("configPath-%v-modTime-%v", configPath, fileInfo.ModTime().UnixMicro())
)
if cacheConfig, found := hclCache.Get(ctx, cacheKey); found {
file = cacheConfig
} else {
file, err = hclparse.NewParser(ctx.ParserOptions...).ParseFromFile(configPath)
if err != nil {
return nil, err
}
}
return TerragruntConfigFromPartialConfig(ctx, l, file, include)
}
Expected behavior
The cache for parsing hcl files works correctly.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working