provider/aws: Expose reason of EMR cluster termination (#15117)

This commit is contained in:
Radek Simko 2017-06-06 13:55:13 +01:00 committed by GitHub
parent 83764294f8
commit 3f3664a4e4
1 changed files with 8 additions and 1 deletions

View File

@ -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
}
}