-
Notifications
You must be signed in to change notification settings - Fork 0
/
ecs.tf
37 lines (33 loc) · 1.01 KB
/
ecs.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
resource "aws_ecs_cluster" "hello_world" {
name = "hello_world"
}
resource "aws_ecs_task_definition" "hello_world" {
family = "hello_world"
network_mode = "awsvpc"
requires_compatibilities = ["FARGATE"]
cpu = "${var.fargate_cpu}"
memory = "${var.fargate_memory}"
container_definitions = <<DEFINITION
[
{
"cpu": ${var.fargate_cpu},
"memory": ${var.fargate_memory},
"image": "${var.container_image}",
"name": "hello_world",
"networkMode": "awsvpc"
}
]
DEFINITION
}
resource "aws_ecs_service" "hello_world" {
name = "hello_world"
cluster = "${aws_ecs_cluster.hello_world.id}"
task_definition = "${aws_ecs_task_definition.hello_world.arn}"
desired_count = "${var.container_count}"
launch_type = "FARGATE"
network_configuration {
subnets = ["${aws_subnet.public.id}"]
assign_public_ip = true
security_groups = ["${aws_security_group.http_access.id}"]
}
}