From 36925b4dc89d781a56096d91e11a7b55067e72d2 Mon Sep 17 00:00:00 2001 From: Luke Kysow <1034429+lkysow@users.noreply.github.com> Date: Wed, 6 Mar 2019 11:20:44 -0500 Subject: [PATCH] Ignore .terragrunt-cache dirs. Fixes #487 --- server/events/pending_plan_finder.go | 5 +++++ server/events/pending_plan_finder_test.go | 24 +++++++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/server/events/pending_plan_finder.go b/server/events/pending_plan_finder.go index 8dd818104f..6818c4bbe1 100644 --- a/server/events/pending_plan_finder.go +++ b/server/events/pending_plan_finder.go @@ -62,6 +62,11 @@ func (p *DefaultPendingPlanFinder) findWithAbsPaths(pullDir string) ([]PendingPl } for _, file := range strings.Split(string(lsOut), "\n") { if filepath.Ext(file) == ".tfplan" { + // Ignore .terragrunt-cache dirs (#487) + if strings.Contains(file, ".terragrunt-cache/") { + continue + } + repoRelDir := filepath.Dir(file) plans = append(plans, PendingPlan{ RepoDir: repoDir, diff --git a/server/events/pending_plan_finder_test.go b/server/events/pending_plan_finder_test.go index 13c36a48cd..6fb86b29a6 100644 --- a/server/events/pending_plan_finder_test.go +++ b/server/events/pending_plan_finder_test.go @@ -139,6 +139,30 @@ func TestPendingPlanFinder_Find(t *testing.T) { }, }, }, + { + ".terragrunt-cache", + map[string]interface{}{ + "default": map[string]interface{}{ + ".terragrunt-cache": map[string]interface{}{ + "N6lY9xk7PivbOAzdsjDL6VUFVYk": map[string]interface{}{ + "K4xpUZI6HgUF-ip6E1eib4L8mwQ": map[string]interface{}{ + "app": map[string]interface{}{ + "default.tfplan": nil, + }, + }, + }, + }, + "default.tfplan": nil, + }, + }, + []events.PendingPlan{ + { + RepoDir: "???/default", + RepoRelDir: ".", + Workspace: "default", + }, + }, + }, } pf := &events.DefaultPendingPlanFinder{}