Skip to content

Commit 0391f5b

Browse files
authored
Merge pull request #10452 from stack72/ecs-service-custom-delete-timeout
resource/ecs_service: Add support for customTimeout on delete
2 parents f79dd0f + 0aac0b7 commit 0391f5b

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

aws/resource_aws_ecs_service.go

+5-1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ func resourceAwsEcsService() *schema.Resource {
2828
State: resourceAwsEcsServiceImport,
2929
},
3030

31+
Timeouts: &schema.ResourceTimeout{
32+
Delete: schema.DefaultTimeout(20 * time.Minute),
33+
},
34+
3135
Schema: map[string]*schema.Schema{
3236
"name": {
3337
Type: schema.TypeString,
@@ -1114,7 +1118,7 @@ func resourceAwsEcsServiceDelete(d *schema.ResourceData, meta interface{}) error
11141118
Cluster: aws.String(d.Get("cluster").(string)),
11151119
}
11161120
// Wait until the ECS service is drained
1117-
err = resource.Retry(5*time.Minute, func() *resource.RetryError {
1121+
err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError {
11181122
log.Printf("[DEBUG] Trying to delete ECS service %s", input)
11191123
_, err := conn.DeleteService(&input)
11201124
if err != nil {

website/docs/r/ecs_service.html.markdown

+7
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,13 @@ In addition to all arguments above, the following attributes are exported:
189189
* `iam_role` - The ARN of IAM role used for ELB
190190
* `desired_count` - The number of instances of the task definition
191191

192+
## Timeouts
193+
194+
`aws_ecs_service` provides the following
195+
[Timeouts](/docs/configuration/resources.html#operation-timeouts) configuration options:
196+
197+
- `delete` - (Default `20 minutes`)
198+
192199
## Import
193200

194201
ECS services can be imported using the `name` together with ecs cluster `name`, e.g.

0 commit comments

Comments
 (0)