Merge pull request #3914 from TimeIncOSS/b-aws-ecs-service-gone
provider/aws: Prevent crashing when deleting ecs_service which is gone
This commit is contained in:
commit
a8ceda1b15
|
@ -156,6 +156,8 @@ func resourceAwsEcsServiceRead(d *schema.ResourceData, meta interface{}) error {
|
|||
}
|
||||
|
||||
if len(out.Services) < 1 {
|
||||
log.Printf("[DEBUG] Removing ECS service %q because it's gone", service.ServiceArn)
|
||||
d.SetId("")
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -247,6 +249,12 @@ func resourceAwsEcsServiceDelete(d *schema.ResourceData, meta interface{}) error
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if len(resp.Services) == 0 {
|
||||
log.Printf("[DEBUG] ECS Service %q is already gone", d.Id())
|
||||
return nil
|
||||
}
|
||||
|
||||
log.Printf("[DEBUG] ECS service %s is currently %s", d.Id(), *resp.Services[0].Status)
|
||||
|
||||
if *resp.Services[0].Status == "INACTIVE" {
|
||||
|
|
Loading…
Reference in New Issue