|
@@ -0,0 +1,104 @@
|
|
|
+# An NLB to allow for a static IP on the hec
|
|
|
+
|
|
|
+#########################
|
|
|
+# DNS Entry
|
|
|
+module "public_dns_record_hec_static" {
|
|
|
+ source = "../../../submodules/dns/public_ALIAS_record"
|
|
|
+
|
|
|
+ name = "${var.prefix}-hec"
|
|
|
+ target_dns_name = aws_lb.hec_static.dns_name
|
|
|
+ target_zone_id = aws_lb.hec_static.zone_id
|
|
|
+ dns_info = var.dns_info
|
|
|
+
|
|
|
+ providers = {
|
|
|
+ aws.mdr-common-services-commercial = aws.mdr-common-services-commercial
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+#########################
|
|
|
+# EIP
|
|
|
+resource "aws_eip" "hec_static" {
|
|
|
+ count = 2
|
|
|
+ vpc = true
|
|
|
+
|
|
|
+ tags = merge(var.standard_tags, var.tags)
|
|
|
+}
|
|
|
+
|
|
|
+#########################
|
|
|
+# ELB
|
|
|
+resource "aws_lb" "hec_static" {
|
|
|
+ tags = merge(var.standard_tags, var.tags)
|
|
|
+ name = "${var.prefix}-hec-static"
|
|
|
+ load_balancer_type = "network"
|
|
|
+ internal = false
|
|
|
+
|
|
|
+ subnet_mapping {
|
|
|
+ subnet_id = var.public_subnets[0]
|
|
|
+ allocation_id = aws_eip.hec_static[0].id
|
|
|
+ }
|
|
|
+
|
|
|
+ subnet_mapping {
|
|
|
+ subnet_id = var.public_subnets[1]
|
|
|
+ allocation_id = aws_eip.hec_static[1].id
|
|
|
+ }
|
|
|
+
|
|
|
+ # Access logs are a feedback loop. They create logs that are then sent back through the HEC.
|
|
|
+ # They should remain disabled.
|
|
|
+ #access_logs {
|
|
|
+ # bucket = "xdr-elb-${ var.environment }"
|
|
|
+ # enabled = true
|
|
|
+ #}
|
|
|
+}
|
|
|
+
|
|
|
+#resource "aws_lb_listener" "front_end" {
|
|
|
+# load_balancer_arn = aws_lb.front_end.arn
|
|
|
+# port = "443"
|
|
|
+# protocol = "TLS"
|
|
|
+# certificate_arn = "arn:aws:iam::187416307283:server-certificate/test_cert_rab3wuqwgja25ct3n4jdj2tzu4"
|
|
|
+# alpn_policy = "HTTP2Preferred"
|
|
|
+#
|
|
|
+# default_action {
|
|
|
+# type = "forward"
|
|
|
+# target_group_arn = aws_lb_target_group.front_end.arn
|
|
|
+# }
|
|
|
+#}
|
|
|
+
|
|
|
+resource "aws_lb_listener" "hec_static_443" {
|
|
|
+ count = anytrue([ local.is_moose, var.hec_listen_443 ]) ? 1 : 0
|
|
|
+ load_balancer_arn = aws_lb.hec_static.arn
|
|
|
+ port = 443
|
|
|
+ protocol = "TCP"
|
|
|
+ default_action {
|
|
|
+ type = "forward"
|
|
|
+ target_group_arn = aws_lb_target_group.hec_static_8088.arn
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+resource "aws_lb_listener" "hec_static_8088" {
|
|
|
+ load_balancer_arn = aws_lb.hec_static.arn
|
|
|
+ port = 8088
|
|
|
+ protocol = "TCP"
|
|
|
+ default_action {
|
|
|
+ type = "forward"
|
|
|
+ target_group_arn = aws_lb_target_group.hec_static_8088.arn
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+resource "aws_lb_target_group" "hec_static_8088" {
|
|
|
+ name = "${var.prefix}-hec-static-targets"
|
|
|
+ port = 8088
|
|
|
+ protocol = "TCP"
|
|
|
+ target_type = "alb"
|
|
|
+ vpc_id = var.vpc_id
|
|
|
+
|
|
|
+# health_chec_static {
|
|
|
+# path = "/services/collector/health/1.0"
|
|
|
+# protocol = "HTTPS"
|
|
|
+# }
|
|
|
+}
|
|
|
+
|
|
|
+resource "aws_lb_target_group_attachment" "hec_static" {
|
|
|
+ target_group_arn = aws_lb_target_group.hec_static_8088.arn
|
|
|
+ target_id = aws_lb.hec.id
|
|
|
+ port = 8088
|
|
|
+}
|