Skip to content

Commit 77a9d38

Browse files
Create loadbalancer.tf
1 parent 4c37329 commit 77a9d38

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
resource "aws_lb" "my-lb" {
2+
name = "lb-tf"
3+
internal = false
4+
load_balancer_type = "application"
5+
security_groups = [aws_security_group.allow_http.id]
6+
# Enter you subnet ids under vpc below
7+
subnets = ["subnet-id1","subnet-id2","subnet-id3","subnet-id4"]
8+
9+
enable_deletion_protection = false
10+
11+
12+
13+
tags = {
14+
name = "my-first-load-balancer"
15+
}
16+
}
17+
18+
resource "aws_lb_listener" "front_end" {
19+
load_balancer_arn = aws_lb.my-lb.arn
20+
port = "80"
21+
protocol = "HTTP"
22+
23+
default_action {
24+
type = "forward"
25+
target_group_arn = aws_lb_target_group.target-lb.arn
26+
}
27+
}

0 commit comments

Comments
 (0)