-
Notifications
You must be signed in to change notification settings - Fork 0
/
16-tg-listener.tf
66 lines (52 loc) · 1.27 KB
/
16-tg-listener.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
#########################
# Default Action
#########################
resource "aws_lb_listener" "listner" {
load_balancer_arn = aws_lb.alb.id
port = 80
protocol = "HTTP"
default_action {
type = "fixed-response"
fixed_response {
content_type = "text/plain"
message_body = " No such Site Found"
status_code = "200"
}
}
}
##################################################
# Forwording rule - one
#
# Considering hostname as blog-one.com
###################################################
resource "aws_lb_listener_rule" "rule-one" {
listener_arn = aws_lb_listener.listner.id
priority = 5
action {
type = "forward"
target_group_arn = aws_lb_target_group.tg-one.arn
}
condition {
host_header {
values = ["blog-one.com"]
}
}
}
##################################################
# Forwording rule - two
#
# Considering hostname as blog-two.com
###################################################
resource "aws_lb_listener_rule" "rule-two" {
listener_arn = aws_lb_listener.listner.id
priority = 6
action {
type = "forward"
target_group_arn = aws_lb_target_group.tg-two.arn
}
condition {
host_header {
values = ["blog-two.com"]
}
}
}