hashicorp / terraform-provider-aws

The AWS Provider enables Terraform to manage AWS resources.
https://registry.terraform.io/providers/hashicorp/aws
Mozilla Public License 2.0
9.61k stars 9k forks source link

aws_ecs_service inconsistent delete timeout handling #17548

Open nijave opened 3 years ago

nijave commented 3 years ago

Community Note

Description

New or Affected Resource(s)

aws_ecs_service.main: Still destroying... [id=arn:aws:ecs:us-east-1:abc123:serv...ng/my-service, 10m0s elapsed]                                                                                                                                                                                                                                     

Error: timeout while waiting for state to become 'INACTIVE' (last state: 'DRAINING', timeout: 10m0s)

The currrent implementation tries to delete for a given timeout but then waits for a fixed amount of time. This leads to failures for services that have high load balancer drain delays set https://github.com/hashicorp/terraform-provider-aws/blob/main/aws/resource_aws_ecs_service.go#L1119 https://github.com/hashicorp/terraform-provider-aws/blob/main/aws/resource_aws_ecs_service.go#L1141

bostrowski13 commented 1 year ago

wonding if there a workaround for this or if this will get some attention.

ZdeAttre commented 1 year ago

Put this parameter in the resource aws_autoscaling_group. It's worked for me.

akuzminsky commented 6 days ago

Put this parameter in the resource aws_autoscaling_group. It's worked for me.

@ZdeAttre, I'm curious why it would work. In my setup, Terraform doesn't attempt to delete the ASG; it just stumbles on deleting the service. Interestingly, the web UI doesn't show the service.