func (c *Client) ApproveRun(runID, message string) error {
	log.Infof("Approving run ID: %s", runID)
	if err := c.TFC.Runs.Apply(c.Context, runID, tfc.RunApplyOptions{
		Comment: &message,
	}); err != nil {
		return err
	}
	run, err := c.TFC.Runs.Read(c.Context, runID)
	if err != nil {
		return err
	}
	return c.waitForTerraformApply(run.Apply.ID)
}
ApproveRun given its ID
package tfcw
import (
	"bufio"
	"fmt"
	"io"
	"io/ioutil"
	"path/filepath"
	"strings"
	"time"
	tfc "github.com/hashicorp/go-tfe"
	"github.com/jpillora/backoff"
	"github.com/manifoldco/promptui"
	"github.com/mvisonneau/tfcw/pkg/schemas"
	log "github.com/sirupsen/logrus"
)
type TFCRunType string
const (
	TFCRunTypePlan TFCRunType = "plan"
	TFCRunTypeApply TFCRunType = "apply"
)
type TFCCreateRunOptions struct {
	AutoApprove  bool
	AutoDiscard  bool
	NoPrompt     bool
	OutputPath   string
	Message      string
	StartTimeout time.Duration
}
func (c *Client) CreateRun(cfg *schemas.Config, w *tfc.Workspace, opts *TFCCreateRunOptions) error {
	log.Info("Preparing plan")
	if !w.Operations {
		return fmt.Errorf("remote operations must be enabled on the workspace")
	}
	configVersion, err := c.createConfigurationVersion(w)
	if err != nil {
		return err
	}
	if err := c.uploadConfigurationVersion(w, configVersion, cfg.Runtime.WorkingDir); err != nil {
		return err
	}
	run, err := c.createRun(w, configVersion, opts.Message)
	if err != nil {
		return err
	}
	if len(opts.OutputPath) > 0 {
		log.Debugf("saving run ID on disk at '%s'", opts.OutputPath)
		if err = ioutil.WriteFile(opts.OutputPath, []byte(run.ID), 0o600); err != nil {
			if err = c.DiscardRun(run.ID, opts.Message); err != nil {
				return err
			}
			return err
		}
	}
	planID, err := c.getTerraformPlanID(run)
	if err != nil {
		if err = c.DiscardRun(run.ID, opts.Message); err != nil {
			return err
		}
		return err
	}
	plan, err := c.waitForTerraformPlan(planID, opts.StartTimeout)
	if err != nil {
		if err = c.DiscardRun(run.ID, opts.Message); err != nil {
			return err
		}
		return err
	}
	if plan.HasChanges {
		if w.AutoApply {
			run, err := c.TFC.Runs.Read(c.Context, run.ID)
			if err != nil {
				return err
			}
			return c.waitForTerraformApply(run.Apply.ID)
		}
		if opts.AutoDiscard {
			return c.DiscardRun(run.ID, opts.Message)
		}
		if opts.AutoApprove {
			return c.ApproveRun(run.ID, opts.Message)
		}
		if opts.NoPrompt {
			return nil
		}
		if promptApproveRun() {
			return c.ApproveRun(run.ID, opts.Message)
		}
		return c.DiscardRun(run.ID, opts.Message)
	}
	return nil
}