Skip to content

aws_ecs_task_definition ClientException: Too many concurrent attempts to create a new revision of the specified family. #258

@wes-nimblerx

Description

@wes-nimblerx

Describe the Feature

When destroy and create task definition, about 1 in 10 we get the below error. Adding skip_destroy variable to aws_ecs_task_definition resource is a workaround to this issue.

Terraform will perform the following actions:
  # aws_ecs_task_definition.service must be replaced
  # module.ecs_web.module.ecs_alb_service_task.aws_ecs_service.default[0] will be updated in-place
  # module.ecs_web.module.ecs_alb_service_task.aws_ecs_task_definition.default[0] must be replaced
Plan: 2 to add, 1 to change, 2 to destroy.
Changes to Outputs:
module.ecs_web.module.ecs_alb_service_task.aws_ecs_task_definition.default[0]: Destroying... [id=team-infra-worker]
aws_ecs_task_definition.service: Destroying... [id=team-infra-worker]
aws_ecs_task_definition.service: Destruction complete after 1s
module.ecs_web.module.ecs_alb_service_task.aws_ecs_task_definition.default[0]: Destruction complete after 1s
aws_ecs_task_definition.service: Creating...
module.ecs_web.module.ecs_alb_service_task.aws_ecs_task_definition.default[0]: Creating...
aws_ecs_task_definition.service: Creation complete after 0s [id=team-infra-worker]
│ Warning: Argument is deprecated
│ 
│   with module.ecs_web.module.ecs_codepipeline.aws_s3_bucket.default,
│   on .terraform/modules/ecs_web.ecs_codepipeline/main.tf line 16, in resource "aws_s3_bucket" "default":
│   16:   acl           = "private"
│ 
│ Use the aws_s3_bucket_acl resource instead
│ Error: creating ECS Task Definition (team-infra-worker): operation error ECS: RegisterTaskDefinition, https response error StatusCode: 400, RequestID: XXXXXXX, ClientException: Too many concurrent attempts to create a new revision of the specified family.
│ 
│   with module.ecs_web.module.ecs_alb_service_task.aws_ecs_task_definition.default[0],
│   on .terraform/modules/ecs_web.ecs_alb_service_task/main.tf line 39, in resource "aws_ecs_task_definition" "default":
│   39: resource "aws_ecs_task_definition" "default" {
│ 
Error: Process completed with exit code 1.

Expected Behavior

destroy and create of new task definition should complete without errors

Use Case

Prevent random terraform error

Describe Ideal Solution

Ideal solution is for terraform to handle a destroy and immediate creation of the task definition reliably without errors

Alternatives Considered

Adding skip_destroy variable to aws_ecs_task_definition resource is a workaround to this issue as the destroy will never happen

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions