Skip to content

Commit

Permalink
Fix relative paths with sops_decrypt_file()
Browse files Browse the repository at this point in the history
sops_decrypt_file() computed the file path relative to the working
directory instead of relative to the Terragrunt configuration. This
generally worked with individual `terragrunt apply` operations but
failed for `terragrunt run-all apply`, as it would look for the file in
the parent directory.

Fixes #1319.
  • Loading branch information
sybereal committed Oct 11, 2023
1 parent ed5b177 commit 6a7026c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions config/config_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -688,7 +688,7 @@ func sopsDecryptFile(params []string, trackInclude *TrackInclude, terragruntOpti
if err != nil {
return "", errors.WithStackTrace(err)
}
canonicalSourceFile, err := util.CanonicalPath(sourceFile, terragruntOptions.WorkingDir)
canonicalSourceFile, err := util.CanonicalPath(sourceFile, filepath.Dir(terragruntOptions.TerragruntConfigPath))
if err != nil {
return "", errors.WithStackTrace(err)
}
Expand All @@ -697,7 +697,7 @@ func sopsDecryptFile(params []string, trackInclude *TrackInclude, terragruntOpti
return val, nil
}

rawData, err := decrypt.File(sourceFile, format)
rawData, err := decrypt.File(canonicalSourceFile, format)
if err != nil {
return "", errors.WithStackTrace(err)
}
Expand Down

0 comments on commit 6a7026c

Please sign in to comment.