Skip to content
This repository was archived by the owner on Oct 31, 2019. It is now read-only.

Commit 40175f7

Browse files
committed
put Network Load Balancer in front of fluentd cluster
1 parent c4b7e37 commit 40175f7

1 file changed

Lines changed: 33 additions & 0 deletions

File tree

terraform/mgmt/logging.tf

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
locals {
2+
logging_port = 514
3+
logging_protocol = "TCP"
4+
}
5+
16
# temporary, until we have an image for this
27
data "aws_ami" "ubuntu" {
38
most_recent = true
@@ -35,9 +40,37 @@ resource "aws_autoscaling_group" "log_forwarding" {
3540
min_size = 1
3641
desired_capacity = 2
3742

43+
target_group_arns = ["${aws_alb_target_group.log_forwarding.arn}"]
44+
3845
tag {
3946
key = "Component"
4047
value = "log-forwarding"
4148
propagate_at_launch = true
4249
}
4350
}
51+
52+
resource "aws_alb" "log_forwarding" {
53+
# TODO make internal?
54+
# internal = true
55+
# https://aws.amazon.com/elasticloadbalancing/details/#compare
56+
load_balancer_type = "network"
57+
# TODO change to private
58+
subnets = ["${module.network.public_subnets}"]
59+
}
60+
61+
resource "aws_alb_target_group" "log_forwarding" {
62+
vpc_id = "${module.network.vpc_id}"
63+
port = "${local.logging_port}"
64+
protocol = "${local.logging_protocol}"
65+
}
66+
67+
resource "aws_alb_listener" "log_forwarding" {
68+
load_balancer_arn = "${aws_alb.log_forwarding.arn}"
69+
port = "${local.logging_port}"
70+
protocol = "${local.logging_protocol}"
71+
72+
default_action {
73+
target_group_arn = "${aws_alb_target_group.log_forwarding.arn}"
74+
type = "forward"
75+
}
76+
}

0 commit comments

Comments
 (0)