-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathservice_discord-scraper.tf
More file actions
54 lines (51 loc) · 1.5 KB
/
service_discord-scraper.tf
File metadata and controls
54 lines (51 loc) · 1.5 KB
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
50
51
52
53
54
resource "aws_ecs_task_definition" "discord-scraper-TD" {
family = "discord-scraper-TD"
requires_compatibilities = ["FARGATE"]
network_mode = "awsvpc"
cpu = 2048
memory = 4096
execution_role_arn = data.aws_iam_role.ecs_task_execution_role.arn
container_definitions = jsonencode([
{
name = "container-name"
image = "discord-scraper"
cpu = 2048
memory = 4096
logConfiguration = {
logDriver = "awslogs"
options = {
awslogs-create-group = "true"
awslogs-group = "/ecs/discord-scraper"
awslogs-region = var.region
awslogs-stream-prefix = "ecs"
}
}
essential = true
portMappings = [
{
containerPort = 80
hostPort = 80
}
]
}
])
}
resource "aws_ecs_service" "discord-scraper-service" {
name = "discord-scraper-service"
cluster = aws_ecs_cluster.base-cluster.id
task_definition = aws_ecs_task_definition.discord-scraper-TD.id
desired_count = 1
depends_on = [
aws_ecs_cluster.base-cluster,
aws_ecs_task_definition.discord-scraper-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]
}
}