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

ECS fargate service created, but the container is not fully ready #6398

Closed
ghost opened this issue Nov 8, 2018 · 3 comments
Closed

ECS fargate service created, but the container is not fully ready #6398

ghost opened this issue Nov 8, 2018 · 3 comments
Labels
enhancement Requests to existing resources that expand the functionality or scope. service/ecs Issues and PRs that pertain to the ecs service.

Comments

@ghost
Copy link

ghost commented Nov 8, 2018

This issue was originally opened by @rajeevr2715 as hashicorp/terraform#19323. It was migrated here as a result of the provider split. The original body of the issue is below.


Terraform Version

Terraform v0.11.7

Terraform Configuration Files

resource "aws_alb_target_group" "alb_target_group_cq" {
  name     = "ecs-cq-tg"
  port     = 80
  protocol = "HTTP"
  vpc_id   = "${data.aws_vpc.vpc_data.id}"
  target_type = "ip"

  health_check {
    path             = "/sessions/new"
    matcher          = "200"
    interval         = "200"
    timeout          = "59"
  }
}

resource "aws_ecs_service" "ecs_service_cq" {
  name            = "ecs_service_cq"
  task_definition = "${aws_ecs_task_definition.ecs_task_definition_cq.family}:${max("${aws_ecs_task_definition.ecs_task_definition_cq.revision}", "${data.aws_ecs_task_definition.ecs_task_definition_cq.revision}")}"
  desired_count   = 1
  launch_type     = "FARGATE"
  health_check_grace_period_seconds  = 3000
  cluster =       "${aws_ecs_cluster.ecs_cluster_cq.id}"

  network_configuration {
    security_groups    = ["${aws_security_group.vpc_sg.id}"]
    subnets            = ["${aws_subnet.subnet_for_ecs.*.id}"]
    assign_public_ip = true
  }

  load_balancer {
    target_group_arn = "${aws_alb_target_group.alb_target_group_cq.arn}"
    container_name   = "ecs_container_cq"
    container_port   = "9000"
  }
  depends_on = ["aws_alb_listener.ecs_alb_listener_cq"]
}

resource "null_resource" "configure" {
  provisioner "local-exec" {
    command = "python ${var.configure_cmd} ${aws_lb.alb_ecs_cq.dns_name} "
  }
  depends_on = ["aws_ecs_service.ecs_service_cq"]
}

Debug Output

Crash Output

Expected Behavior

depends_on should check, the container is up and running. ie, here sonarqube is running on ec2 fargate. Sonarqube container will take some time to start up delay. If I add this code at the end of resource

provisioner "local-exec" {
command = "sleep 2m"
}

It will work.

Actual Behavior

Null resource with depends_on to aws_ecs_service will get failed with request timeout. Even the health check interval is not actually wait for the container to fully up and running.

Steps to Reproduce

Additional Context

References

@bflad bflad added enhancement Requests to existing resources that expand the functionality or scope. service/ecs Issues and PRs that pertain to the ecs service. labels Nov 8, 2018
@tomelliff
Copy link
Contributor

I think this is a duplicate of #3107 which has an open but stalled PR at #3485

@bflad
Copy link
Contributor

bflad commented Nov 13, 2018

Thanks for the heads up, @tomelliff! I agree.

@rajeevr2715 this appears to be a similar ask to #3107 so to consolidate discussions and efforts, I'm going to close this issue in preference of the earlier one. I would suggest adding a 👍 reaction to the original issue to help prioritization and following along there. I also fixed the labelling on the old issue so hopefully more folks can find it as an enhancement rather than a question. 😄

@bflad bflad closed this as completed Nov 13, 2018
@ghost
Copy link
Author

ghost commented Apr 2, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked and limited conversation to collaborators Apr 2, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement Requests to existing resources that expand the functionality or scope. service/ecs Issues and PRs that pertain to the ecs service.
Projects
None yet
Development

No branches or pull requests

2 participants