From a6c4fb504fe5fbf869ca3d3f961886522daf80d9 Mon Sep 17 00:00:00 2001 From: Steven Masley Date: Thu, 5 Jun 2025 11:47:18 -0500 Subject: [PATCH 1/2] chore: ignore `.git` directories in terraform modules .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 363afe3f40fc0..00ac3be274e5f 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 } + + if fileMode.IsDir() && d.Name() == ".git" { + // .git directories are not needed in the archive and only cause + // hash differences for identical modules. + return fs.SkipDir + } + fileInfo, err := d.Info() if err != nil { return xerrors.Errorf("failed to archive module file %q: %w", filePath, err) From 54483e6f65bf358441744b804e40caa64d683bdc Mon Sep 17 00:00:00 2001 From: Steven Masley Date: Thu, 5 Jun 2025 12:03:23 -0500 Subject: [PATCH 2/2] move comment --- provisioner/terraform/modules.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/provisioner/terraform/modules.go b/provisioner/terraform/modules.go index 00ac3be274e5f..e0da5f1578069 100644 --- a/provisioner/terraform/modules.go +++ b/provisioner/terraform/modules.go @@ -104,9 +104,9 @@ func GetModulesArchive(root fs.FS) ([]byte, error) { return nil } + // .git directories are not needed in the archive and only cause + // hash differences for identical modules. if fileMode.IsDir() && d.Name() == ".git" { - // .git directories are not needed in the archive and only cause - // hash differences for identical modules. return fs.SkipDir }