diff --git a/builtin/providers/aws/resource_aws_emr_cluster.go b/builtin/providers/aws/resource_aws_emr_cluster.go index ee8868aae..f1a0d5512 100644 --- a/builtin/providers/aws/resource_aws_emr_cluster.go +++ b/builtin/providers/aws/resource_aws_emr_cluster.go @@ -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 } }