fix(provisionersdk): allow .terraform.lock.hcl files to be archived (#7604)

This commit is contained in:
Colin Adler
2023-05-19 13:22:59 -04:00
committed by GitHub
parent a29c4c543d
commit ef2411ef17
2 changed files with 50 additions and 25 deletions
+3 -1
View File
@@ -73,7 +73,9 @@ func Tar(w io.Writer, directory string, limit int64) error {
if err != nil {
return err
}
if strings.HasPrefix(rel, ".") || strings.HasPrefix(filepath.Base(rel), ".") {
// We want to allow .terraform.lock.hcl files to be archived. This
// allows provider plugins to be cached.
if (strings.HasPrefix(rel, ".") || strings.HasPrefix(filepath.Base(rel), ".")) && filepath.Base(rel) != ".terraform.lock.hcl" {
if fileInfo.IsDir() && rel != "." {
// Don't archive hidden files!
return filepath.SkipDir