-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathservice_bot_telegram.tf
49 lines (45 loc) · 1.35 KB
/
service_bot_telegram.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
38
39
40
41
42
43
44
45
46
47
48
49
resource "aws_ecs_task_definition" "telegrambot-TD" {
family = "telegrambot-TD"
requires_compatibilities = ["FARGATE"]
network_mode = "awsvpc"
cpu = 512
memory = 1024
execution_role_arn = data.aws_iam_role.ecs_task_execution_role.arn
container_definitions = jsonencode([
{
name = "container-name"
image = "nginx"
cpu = 512
memory = 1024
logConfiguration = {
logDriver = "awslogs"
options = {
awslogs-create-group = "true"
awslogs-group = "/ecs/telegrambot"
awslogs-region = var.region
awslogs-stream-prefix = "ecs"
}
}
essential = true
}
])
}
resource "aws_ecs_service" "telegram-service" {
name = "telegram-service"
cluster = aws_ecs_cluster.base-cluster.id
task_definition = aws_ecs_task_definition.telegrambot-TD.id
desired_count = 1
depends_on = [
aws_ecs_cluster.base-cluster,
aws_ecs_task_definition.telegrambot-TD,
]
launch_type = "FARGATE"
network_configuration {
subnets = [aws_subnet.private-subnet-a.id, aws_subnet.private-subnet-b.id]
security_groups = [aws_security_group.service-sg.id]
assign_public_ip = true
}
lifecycle {
ignore_changes = [task_definition]
}
}