-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtarget-group.tf
70 lines (61 loc) · 1.97 KB
/
target-group.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
68
69
70
# Web Portal target group
module "prod_web_tg" {
source = "./modules/target-group"
target_group_name = "web-app-prod-tg"
target_group_vpc_id = module.prod_vpc.aws_vpc_id
target_group_type = "instance"
health_check = {
enabled = true
protocol = "http"
path = "/"
port = "traffic-port"
healthy_threshold = 5
unhealthy_threshold = 2
}
host_header = {
values = ["example.net"] # Provide host header
}
listener_rule_name = "redirect-to-web-portal"
listener_rule_priority_number = 1
https_listener_arn = module.prod_alb.alb_https_listener_arn
}
module "prod_admin_tg" {
source = "./modules/target-group"
target_group_name = "admin-panel-prod-tg"
target_group_vpc_id = module.prod_vpc.aws_vpc_id
target_group_type = "instance"
health_check = {
enabled = true
protocol = "http"
path = "/"
port = "traffic-port"
healthy_threshold = 5
unhealthy_threshold = 2
}
host_header = {
values = ["admin.example.net"] # Provide host header
}
listener_rule_name = "redirect-to-admin-panel"
listener_rule_priority_number = 2
https_listener_arn = module.prod_alb.alb_https_listener_arn
}
module "prod_api_tg" {
source = "./modules/target-group"
target_group_name = "api-prod-tg"
target_group_vpc_id = module.prod_vpc.aws_vpc_id
target_group_type = "instance"
health_check = {
enabled = true
protocol = "http"
path = "/api/v1/"
port = "traffic-port"
healthy_threshold = 3
unhealthy_threshold = 2
}
host_header = {
values = ["api.example.net"] # Provide host header
}
listener_rule_name = "redirect-to-api"
listener_rule_priority_number = 3
https_listener_arn = module.prod_alb.alb_https_listener_arn
}