Skip or approve jobs based on job output

I want a workflow like this:

  1. run terraform plan
  2. if terraform plan returns successful, go to step 6
  3. if terraform plan returned failure, go to step 4
  4. hold for approval
  5. run `terraform apply
  6. run terraform plan on something else

It doesn’t seem possible in the configuration, and I have not found any way in the API to do this.