FEATURES PRICING ABOUT DOCS LOGIN

aws_ecs_service

-> Note: To prevent a race condition during service deletion, make sure to set depends_on to the related aws_iam_role_policy; otherwise, the policy may be destroyed too soon and the ECS service will then get stuck in the DRAINING state.

Provides an ECS service - effectively a task that is expected to run until an error occurs or a user terminates it (typically a webserver or a database).

See ECS Services section in AWS developer guide.

Example Usage

resource "aws_ecs_service" "mongo" {
  name = "mongodb"
  cluster = "${aws_ecs_cluster.foo.id}"
  task_definition = "${aws_ecs_task_definition.mongo.arn}"
  desired_count = 3
  iam_role = "${aws_iam_role.foo.arn}"
  depends_on = ["aws_iam_role_policy.foo"]

  load_balancer {
    elb_name = "${aws_elb.foo.name}"
    container_name = "mongo"
    container_port = 8080
  }
}

Argument Reference

The following arguments are supported:

-> Note: As a result of an AWS limitation, a single load_balancer can be attached to the ECS service at most. See related docs.

Load balancers support the following:

Attributes Reference

The following attributes are exported:


See the source of this document at Terraform.io

REQUEST A DEMO