Skip to content

Commit

Permalink
fix: 🐛 ensure that we are running tf in the correct dir (#681)
Browse files Browse the repository at this point in the history
  • Loading branch information
jaskaransarkaria authored Jan 23, 2025
1 parent 424dcf8 commit 7443496
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/environment/apply.go
Original file line number Diff line number Diff line change
Expand Up @@ -278,10 +278,14 @@ func (a *Apply) deleteKubectl() (string, error) {

// applyTerraform calls applier -> TerraformInitAndApply and prints the output from applier
func (a *Apply) applyTerraform() (string, error) {
log.Printf("Running Terraform Apply for namespace: %v", a.Options.Namespace)
log.Printf("Running Terraform Apply for namespace: %v. In directory %v", a.Options.Namespace, a.Dir)

tfFolder := a.Dir + "/resources"

if strings.Contains(a.Dir, a.Options.Namespace) {
return "", fmt.Errorf("error running terraform as directory and namespace are not aligned Dir=%v and Namespace=%v", a.Dir, a.Options.Namespace)
}

outputTerraform, err := a.Applier.TerraformInitAndApply(a.Options.Namespace, tfFolder)

if a.Options.IsApplyPipeline && err != nil {
Expand Down

0 comments on commit 7443496

Please sign in to comment.