Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

resource/ecs_service: Add support for customTimeout on delete #10452

Merged
merged 2 commits into from
Jun 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion aws/resource_aws_ecs_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ func resourceAwsEcsService() *schema.Resource {
State: resourceAwsEcsServiceImport,
},

Timeouts: &schema.ResourceTimeout{
Delete: schema.DefaultTimeout(20 * time.Minute),
},

Schema: map[string]*schema.Schema{
"name": {
Type: schema.TypeString,
Expand Down Expand Up @@ -950,7 +954,7 @@ func resourceAwsEcsServiceDelete(d *schema.ResourceData, meta interface{}) error
Cluster: aws.String(d.Get("cluster").(string)),
}
// Wait until the ECS service is drained
err = resource.Retry(5*time.Minute, func() *resource.RetryError {
err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError {
log.Printf("[DEBUG] Trying to delete ECS service %s", input)
_, err := conn.DeleteService(&input)
if err != nil {
Expand Down
7 changes: 7 additions & 0 deletions website/docs/r/ecs_service.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,13 @@ In addition to all arguments above, the following attributes are exported:
* `iam_role` - The ARN of IAM role used for ELB
* `desired_count` - The number of instances of the task definition

## Timeouts

`aws_ecs_service` provides the following
[Timeouts](/docs/configuration/resources.html#operation-timeouts) configuration options:

- `delete` - (Default `20 minutes`)

## Import

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