Skip to content

Commit

Permalink
provider/aws: Expose reason of EMR cluster termination (#15117)
Browse files Browse the repository at this point in the history
  • Loading branch information
radeksimko authored Jun 6, 2017
1 parent 8376429 commit 3f3664a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion builtin/providers/aws/resource_aws_emr_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -831,6 +831,13 @@ func resourceAwsEMRClusterStateRefreshFunc(d *schema.ResourceData, meta interfac
log.Printf("[DEBUG] EMR Cluster status (%s): %s", d.Id(), *resp.Cluster.Status)
}

return emrc, *emrc.Status.State, nil
status := emrc.Status
if *status.State == "TERMINATING" {
reason := *status.StateChangeReason
return emrc, *status.State, fmt.Errorf("EMR Cluster is terminating. %s: %s",
*reason.Code, *reason.Message)
}

return emrc, *status.State, nil
}
}

0 comments on commit 3f3664a

Please sign in to comment.