-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathecs-task.tf
28 lines (26 loc) · 910 Bytes
/
ecs-task.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
resource "aws_ecs_task_definition" "task_container_file" {
count = 0
family = "tasks"
network_mode = "awsvpc"
requires_compatibilities = ["FARGATE"]
cpu = 512
memory = 2048
container_definitions = file(
"${path.module}/resources/ecs-task-definitions/nginx.json"
)
}
resource "aws_ecs_service" "service_file" {
count = 0
name = "my_service"
cluster = aws_ecs_cluster.my_cluster.id
task_definition = aws_ecs_task_definition.task_container_file[0].id
# Creating services with 2 instances to start
desired_count = 1
launch_type = "FARGATE"
platform_version = "LATEST"
network_configuration {
assign_public_ip = false
security_groups = [aws_security_group.sg.id]
subnets = [aws_subnet.subnet.id]
}
}