generated from dxw/terraform-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathecs-cluster-infrastructure-service-alb-global-accelerator.tf
67 lines (54 loc) · 2.56 KB
/
ecs-cluster-infrastructure-service-alb-global-accelerator.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
resource "aws_globalaccelerator_accelerator" "infrastructure_ecs_cluster_service_alb" {
count = local.infrastructure_ecs_cluster_services_alb_enable_global_accelerator ? 1 : 0
name = "${local.resource_prefix_hash}-infrastructure-ecs-cluster-service-alb"
ip_address_type = "IPV4"
enabled = true
}
resource "aws_globalaccelerator_listener" "infrastructure_ecs_cluster_service_alb_http" {
count = local.infrastructure_ecs_cluster_services_alb_enable_global_accelerator ? 1 : 0
accelerator_arn = aws_globalaccelerator_accelerator.infrastructure_ecs_cluster_service_alb[0].id
client_affinity = "SOURCE_IP"
protocol = "TCP"
port_range {
from_port = 80
to_port = 80
}
}
resource "aws_globalaccelerator_listener" "infrastructure_ecs_cluster_service_alb_https" {
count = local.infrastructure_ecs_cluster_services_alb_enable_global_accelerator && local.enable_infrastructure_wildcard_certificate ? 1 : 0
accelerator_arn = aws_globalaccelerator_accelerator.infrastructure_ecs_cluster_service_alb[0].id
client_affinity = "SOURCE_IP"
protocol = "TCP"
port_range {
from_port = 443
to_port = 443
}
}
resource "aws_globalaccelerator_endpoint_group" "service_loadbalancer_alb_http" {
count = local.infrastructure_ecs_cluster_services_alb_enable_global_accelerator ? 1 : 0
listener_arn = aws_globalaccelerator_listener.infrastructure_ecs_cluster_service_alb_http[0].id
endpoint_group_region = local.aws_region
health_check_interval_seconds = 30
health_check_protocol = "TCP"
threshold_count = 3
traffic_dial_percentage = 100
endpoint_configuration {
client_ip_preservation_enabled = false
endpoint_id = aws_alb.infrastructure_ecs_cluster_service[0].arn
weight = 100
}
}
resource "aws_globalaccelerator_endpoint_group" "service_loadbalancer_alb_https" {
count = local.infrastructure_ecs_cluster_services_alb_enable_global_accelerator && local.enable_infrastructure_wildcard_certificate ? 1 : 0
listener_arn = aws_globalaccelerator_listener.infrastructure_ecs_cluster_service_alb_https[0].id
endpoint_group_region = local.aws_region
health_check_interval_seconds = 30
health_check_protocol = "TCP"
threshold_count = 3
traffic_dial_percentage = 100
endpoint_configuration {
client_ip_preservation_enabled = false
endpoint_id = aws_alb.infrastructure_ecs_cluster_service[0].arn
weight = 100
}
}