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
This commit is contained in:
Steven Masley
2025-06-05 12:57:13 -05:00
committed by GitHub
parent 3f406c7c50
commit 60595f3455
+7
View File
@@ -103,6 +103,13 @@ func GetModulesArchive(root fs.FS) ([]byte, error) {
if !fileMode.IsRegular() && !fileMode.IsDir() {
return nil
}
// .git directories are not needed in the archive and only cause
// hash differences for identical modules.
if fileMode.IsDir() && d.Name() == ".git" {
return fs.SkipDir
}
fileInfo, err := d.Info()
if err != nil {
return xerrors.Errorf("failed to archive module file %q: %w", filePath, err)