Skip to content

Commit 60595f3

Browse files
authored
chore: ignore .git directories in terraform modules (#18255)
.git directories were causing identical modules to have different hashes. This adds unecessary bloat to the database, and the .git directory is not needed for dynamic params
1 parent 3f406c7 commit 60595f3

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

provisioner/terraform/modules.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,13 @@ func GetModulesArchive(root fs.FS) ([]byte, error) {
103103
if !fileMode.IsRegular() && !fileMode.IsDir() {
104104
return nil
105105
}
106+
107+
// .git directories are not needed in the archive and only cause
108+
// hash differences for identical modules.
109+
if fileMode.IsDir() && d.Name() == ".git" {
110+
return fs.SkipDir
111+
}
112+
106113
fileInfo, err := d.Info()
107114
if err != nil {
108115
return xerrors.Errorf("failed to archive module file %q: %w", filePath, err)

0 commit comments

Comments
 (0)