-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathlb_jenkins_ecs_agent.tf
65 lines (55 loc) · 1.57 KB
/
lb_jenkins_ecs_agent.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
#
# Copyright (C) 2020 ByteSource Technology Consulting GmbH
#
# All rights reserved - Do Not Redistribute
#
resource "aws_lb" "nlb" {
internal = true
load_balancer_type = "network"
subnets = var.private_subnets
tags = merge(var.tags, { Name = "Serverless Jenkins LoadBalancer" })
}
resource "aws_lb_target_group" "jenkins_agent_jnlp" {
port = 50000
protocol = "TCP"
target_type = "ip"
vpc_id = var.vpc_id
# Give Jenkins enough time to start and especially to restart after plugin updates
health_check {
protocol = "TCP"
interval = 30
healthy_threshold = 10
unhealthy_threshold = 10
}
}
resource "aws_lb_listener" "jenkins_agent_jnlp" {
load_balancer_arn = aws_lb.nlb.arn
port = "50000"
protocol = "TCP"
default_action {
target_group_arn = aws_lb_target_group.jenkins_agent_jnlp.arn
type = "forward"
}
}
resource "aws_lb_target_group" "jenkins_agent_http" {
port = 8001
protocol = "TCP"
target_type = "ip"
vpc_id = var.vpc_id
# Give Jenkins enough time to start and especially to restart after plugin updates
health_check {
protocol = "TCP"
interval = 30
healthy_threshold = 10
unhealthy_threshold = 10
}
}
resource "aws_lb_listener" "jenkins_agent_http" {
load_balancer_arn = aws_lb.nlb.arn
port = "8001"
protocol = "TCP"
default_action {
target_group_arn = aws_lb_target_group.jenkins_agent_http.arn
type = "forward"
}
}