Skip to content

Commit

Permalink
fix: include missing param in parsing cache key construction (gruntwo…
Browse files Browse the repository at this point in the history
  • Loading branch information
untcha authored and hugorut committed Oct 10, 2023
1 parent 64578fc commit 14acfeb
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions config/config_partial.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ func PartialParseConfigFile(
var terragruntConfigCache = NewTerragruntConfigCache()

// Wrapper of PartialParseConfigString which checks for cached configs.
// configString, includeFromChild and decodeList are used for the cache key,
// filename, configString, includeFromChild and decodeList are used for the cache key,
// by getting the default value (%#v) through fmt.
func TerragruntConfigFromPartialConfigString(
configString string,
Expand All @@ -169,19 +169,19 @@ func TerragruntConfigFromPartialConfigString(
decodeList []PartialDecodeSectionType,
) (*TerragruntConfig, error) {
if terragruntOptions.UsePartialParseConfigCache {
var cacheKey = fmt.Sprintf("%#v-%#v-%#v", configString, includeFromChild, decodeList)
var cacheKey = fmt.Sprintf("%#v-%#v-%#v-%#v", filename, configString, includeFromChild, decodeList)
var config, found = terragruntConfigCache.Get(cacheKey)

if !found {
terragruntOptions.Logger.Debugf("Cache miss for '%s' (partial parsing).", filename)
terragruntOptions.Logger.Debugf("Cache miss for '%s' (partial parsing), decodeList: '%v'.", filename, decodeList)
tgConfig, err := PartialParseConfigString(configString, terragruntOptions, includeFromChild, filename, decodeList)
if err != nil {
return nil, err
}
config = *tgConfig
terragruntConfigCache.Put(cacheKey, config)
} else {
terragruntOptions.Logger.Debugf("Cache hit for '%s' (partial parsing).", filename)
terragruntOptions.Logger.Debugf("Cache hit for '%s' (partial parsing), decodeList: '%v'.", filename, decodeList)
}

return &config, nil
Expand Down

0 comments on commit 14acfeb

Please sign in to comment.