I'm trying to launch an ECS cluster with Fargate Tasks.
Here's my Terraform resource
resource "aws_ecs_task_definition" "ecs-zoo" {
family = "${var.project}"
container_definitions = "${data.template_file.ecs-zookeeper.rendered}"
network_mode = "awsvpc"
cpu = 512
memory = 1024
requires_compatibilities = ["FARGATE"]
}
And here's my task definition
[
{
"name": "zoo",
"image": "${zoo_image}",
"essential": true,
"portMappings": [
{
"containerPort": ${zook_port},
"hostPort": ${zook_port}
}
],
"environment": [
{
"name": "ZOO_SERVERS",
"value": "${zook-servers}"
}
]
}
]
Here is the service resource
resource "aws_ecs_service" "ecs-zoo" {
name = "${var.project}${count.index+1}"
cluster = "${aws_ecs_cluster.ecs.id}"
task_definition = "${aws_ecs_task_definition.ecs-zoo.arn}"
enable_ecs_managed_tags = true
desired_count = 1
propagate_tags = "SERVICE"
deployment_minimum_healthy_percent = 100
deployment_maximum_percent = 400
network_configuration {
subnets = "${var.vpc_subnets}"
security_groups = ["${aws_security_group.ecs.id}"]
assign_public_ip = false
}
service_registries {
registry_arn = "${aws_service_discovery_service.discovery_service-zoo.*.arn[count.index]}"
}
lifecycle {
create_before_destroy = true
}
count = "${var.zoo-instance-number}"
}
The problem is that it only launches EC2 tasks and not FARGATE as you can see in the snapshot.
If I check the task definition in the console it says this
What am I doing wrong?