github.com/tilotech/tilores-cli@v0.28.0/internal/pkg/step/terraformapply.go (about)

     1  package step
     2  
     3  import "fmt"
     4  
     5  // TerraformApply creates a step that runs terraform apply with the provided arguments.
     6  func TerraformApply(workspace string, args ...string) Step {
     7  	args = append([]string{"apply", "-auto-approve"}, args...)
     8  	command := createCommand("terraform", args...)
     9  	command.Env = append(command.Env, tfWorkspaceEnv(workspace))
    10  	return runCommand("could not apply: %v", command)
    11  }
    12  
    13  func tfWorkspaceEnv(workspace string) string {
    14  	return fmt.Sprintf("TF_WORKSPACE=%v", workspace)
    15  }