From 60595f3455b2ac73bdda551358de35c3a16cb6a5 Mon Sep 17 00:00:00 2001 From: Steven Masley Date: Thu, 5 Jun 2025 12:57:13 -0500 Subject: [PATCH] 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 --- provisioner/terraform/modules.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/provisioner/terraform/modules.go b/provisioner/terraform/modules.go index 363afe3f40..e0da5f1578 100644 --- a/provisioner/terraform/modules.go +++ b/provisioner/terraform/modules.go @@ -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)