-
Notifications
You must be signed in to change notification settings - Fork 0
/
alb.tf
42 lines (35 loc) · 989 Bytes
/
alb.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
#######
# Internal jenkins ALB Resources
#######
resource "aws_alb" "jenkins-alb" {
name = "Jenkins-ALB"
internal = true
load_balancer_type = "application"
security_groups = ["${aws_security_group.jenkins-alb-securitygroup.id}"]
subnets = ["${data.terraform_remote_state.vpc.private_subnets}"]
tags = {
Name = "Jenkins-ALB"
}
}
# Define a listener
resource "aws_alb_listener" "jenkins-listener" {
load_balancer_arn = "${aws_alb.jenkins-alb.arn}"
port = "8080"
protocol = "HTTP"
default_action {
target_group_arn = "${aws_alb_target_group.jenkins.arn}"
type = "forward"
}
}
# Target Groups Section
resource "aws_alb_target_group" "jenkins" {
name = "Jenkins-TargetGroup"
port = 8080
protocol = "HTTP"
vpc_id = "${data.terraform_remote_state.vpc.vpc_id}"
health_check = [{
path = "/robots.txt"
protocol = "HTTP"
matcher = "200"
}]
}