Skip to content

Add skip_destroy variable to aws_ecs_task_definition in module.ecs_alb_service_task #295

Open
@wes-nimblerx

Description

@wes-nimblerx

Describe the Feature

Adding this variable is dependent on the below feature request
cloudposse/terraform-aws-ecs-alb-service-task#258

This is a workaround to prevent the below error from happening about 1 in 10 apply

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

skip_destroy = true will prevent the destroy from happening and further reduce the chance of too many concurrent attempts│

Use Case

This is a workaround to prevent the below error from happening about 1 in 10 apply

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.
│

Describe Ideal Solution

Fix the terraform code to reliably handle a destroy and immediate create of a new task definition every time

Alternatives Considered

This is a workaround to prevent the below error from happening about 1 in 10 apply

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.
│

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