diff --git a/builtin/providers/aws/resource_aws_ecs_service.go b/builtin/providers/aws/resource_aws_ecs_service.go index ab8562acb..749d75900 100644 --- a/builtin/providers/aws/resource_aws_ecs_service.go +++ b/builtin/providers/aws/resource_aws_ecs_service.go @@ -160,6 +160,14 @@ func resourceAwsEcsServiceRead(d *schema.ResourceData, meta interface{}) error { } service := out.Services[0] + + // Status==INACTIVE means deleted service + if *service.Status == "INACTIVE" { + log.Printf("[DEBUG] Removing ECS service %q because it's INACTIVE", service.ServiceArn) + d.SetId("") + return nil + } + log.Printf("[DEBUG] Received ECS service %s", service) d.SetId(*service.ServiceArn)