Skip to content

Commit 9c5ed3b

Browse files
committed
fix(terragrunt): fix command execution
1 parent b9cb5be commit 9c5ed3b

1 file changed

Lines changed: 18 additions & 1 deletion

File tree

db_lib/TerraformApp.go

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,24 @@ func (t *TerraformApp) isWorkspacesSupported(environmentVars []string) bool {
199199
func (t *TerraformApp) selectWorkspace(workspace string, environmentVars []string) error {
200200
args := []string{"workspace", "select", "-or-create=true", workspace}
201201
if t.Name == string(db.AppTerragrunt) {
202-
args = append([]string{"run", "--"}, args...)
202+
203+
tgArgs := []string{"run"}
204+
205+
hasTfPath := false
206+
for i := 0; i < len(tgArgs); i++ {
207+
a := tgArgs[i]
208+
if a == "--tf-path" || strings.HasPrefix(a, "--tf-path=") {
209+
hasTfPath = true
210+
break
211+
}
212+
}
213+
if !hasTfPath {
214+
tgArgs = append(tgArgs, "--tf-path=terraform")
215+
}
216+
217+
tgArgs = append(tgArgs, "--")
218+
219+
args = append(tgArgs, args...)
203220
}
204221
cmd := t.makeCmd(t.Name, args, environmentVars)
205222
t.Logger.LogCmd(cmd)

0 commit comments

Comments
 (0)