-
Notifications
You must be signed in to change notification settings - Fork 0
/
ecs_service.tf
35 lines (31 loc) · 1.13 KB
/
ecs_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
resource "aws_ecs_service" "this" {
name = var.service_name
launch_type = "FARGATE"
cluster = var.cluster_arn
task_definition = aws_ecs_task_definition.service.arn
desired_count = var.ecs_desired_count
load_balancer {
target_group_arn = aws_lb_target_group.this.arn
container_name = var.load_balancer_container_name != null ? var.load_balancer_container_name : var.service_name
container_port = var.container_port
}
network_configuration {
subnets = var.subnets
security_groups = [aws_security_group.ecs_task.id]
# If you are using Fargate tasks, in order for the task to pull the container image it must either use a public subnet and be assigned a
# public IP address or a private subnet that has a route to the internet or a NAT gateway that can route requests to the internet.
assign_public_ip = var.assign_public_ip
}
# This allows dynamic scaling and external deployments
lifecycle {
ignore_changes = [
desired_count,
task_definition,
load_balancer
]
}
deployment_circuit_breaker {
enable = true
rollback = true
}
}