-
Notifications
You must be signed in to change notification settings - Fork 0
/
service.tf
42 lines (36 loc) · 1.08 KB
/
service.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
resource "aws_ecs_service" "main" {
name = "${var.name}-service"
cluster = var.cluster_id
task_definition = aws_ecs_task_definition.main.arn
desired_count = var.initial_desired_count
launch_type = "FARGATE"
network_configuration {
security_groups = var.security_groups
subnets = var.private_subnet_ids
}
dynamic "load_balancer" {
for_each = var.lb_target_group_arns
content {
target_group_arn = load_balancer.value
container_name = var.container_name
container_port = var.container_port
}
}
dynamic "service_registries" {
for_each = var.service_registries
content {
registry_arn = service_registries.value["registry_arn"]
port = lookup(service_registries.value, "port", null)
container_port = lookup(service_registries.value, "container_port", null)
container_name = lookup(service_registries.value, "container_name", null)
}
}
lifecycle {
ignore_changes = [
desired_count,
]
}
depends_on = [
aws_ecs_task_definition.main,
]
}