Skip to content

Commit

Permalink
Also handle TERMINATING state
Browse files Browse the repository at this point in the history
  • Loading branch information
joelthompson committed Oct 10, 2019
1 parent e2dd6c0 commit bfb2dea
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions aws/resource_aws_emr_instance_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,10 +200,15 @@ func resourceAwsEMRInstanceGroupRead(d *schema.ResourceData, meta interface{}) e
return fmt.Errorf("error reading EMR Instance Group (%s): %s", d.Id(), err)
}

if ig.Status != nil && aws.StringValue(ig.Status.State) == emr.InstanceGroupStateTerminated {
log.Printf("[DEBUG] EMR Instance Group (%s) terminated, removing", d.Id())
d.SetId("")
return nil
if ig.Status != nil {
switch aws.StringValue(ig.Status.State) {
case emr.InstanceGroupStateTerminating:
fallthrough
case emr.InstanceGroupStateTerminated:
log.Printf("[DEBUG] EMR Instance Group (%s) terminated, removing", d.Id())
d.SetId("")
return nil
}
}

switch {
Expand Down

0 comments on commit bfb2dea

Please sign in to comment.