@@ -61,8 +61,6 @@ data "aws_acm_certificate" "this" {
6161 domain = " ${ var . certificate_name != " " ? var . certificate_name : local . cert_name } "
6262}
6363
64- # TODO: need to separate into 2 resources to support logging, since network doesn't
65- /*
6664resource "aws_lb" "application" {
6765 count = " ${ module . enabled . value && var . type == " application" ? 1 : 0 } "
6866 name = " ${ module . label . id_32 } "
@@ -91,10 +89,10 @@ resource "aws_lb" "application" {
9189 delete =
9290 update =
9391 }
94- *//*
92+ */
9593 depends_on = [" aws_s3_bucket.log_bucket" ]
9694}
97- /*
95+
9896resource "aws_lb" "network" {
9997 count = " ${ module . enabled . value && var . type == " network" ? 1 : 0 } "
10098 name = " ${ module . label . id_32 } "
@@ -117,9 +115,10 @@ resource "aws_lb" "network" {
117115 delete =
118116 update =
119117 }
120- *//*
118+ */
121119}
122- */
120+
121+ /*
123122resource "aws_lb" "this" {
124123 count = "${module.enabled.value}"
125124 name = "${module.label.id_32}"
@@ -151,9 +150,10 @@ resource "aws_lb" "this" {
151150 delete =
152151 update =
153152 }
154- */
153+ *//*
155154 depends_on = ["aws_s3_bucket.log_bucket"]
156155}
156+ */
157157
158158data "aws_iam_policy_document" "bucket_policy" {
159159 count = " ${
@@ -326,7 +326,8 @@ resource "aws_lb_listener" "http" {
326326 var . type == " application" &&
327327 contains (var. lb_protocols , " HTTP" )
328328 ? length (compact (split (" ," , local. lb_http_ports ))) : 0 } "
329- load_balancer_arn = " ${ aws_lb . this . arn } "
329+ # load_balancer_arn = "${aws_lb.this.arn}" # "${coalesce(aws_lb.application.arn, aws_lb.network.arn)}"
330+ load_balancer_arn = " ${ coalesce (aws_lb. application . arn , aws_lb. network . arn )} "
330331 port = " ${ element (compact (split (" ," ,local. lb_http_ports )), count. index )} "
331332 protocol = " HTTP"
332333 default_action {
@@ -342,7 +343,8 @@ resource "aws_lb_listener" "https" {
342343 var . type == " application" &&
343344 contains (var. lb_protocols , " HTTPS" )
344345 ? length (compact (split (" ," , local. lb_https_ports ))) : 0 } "
345- load_balancer_arn = " ${ aws_lb . this . arn } "
346+ # load_balancer_arn = "${aws_lb.this.arn}" # "${coalesce(aws_lb.application.arn, aws_lb.network.arn)}"
347+ load_balancer_arn = " ${ coalesce (aws_lb. application . arn , aws_lb. network . arn )} "
346348 port = " ${ element (compact (split (" ," ,local. lb_https_ports )), count. index )} "
347349 protocol = " HTTPS"
348350 certificate_arn = " ${ element (concat (data. aws_acm_certificate . this . * . arn , list (" " )), 0 )} "
@@ -359,7 +361,8 @@ resource "aws_lb_listener" "network" {
359361 module . enabled . value &&
360362 var . type == " network"
361363 ? length (compact (split (" ," , local. lb_tcp_ports ))) : 0 } "
362- load_balancer_arn = " ${ aws_lb . this . arn } "
364+ # load_balancer_arn = "${aws_lb.this.arn}" # "${coalesce(aws_lb.application.arn, aws_lb.network.arn)}"
365+ load_balancer_arn = " ${ coalesce (aws_lb. application . arn , aws_lb. network . arn )} "
363366 port = " ${ element (compact (split (" ," ,local. lb_tcp_ports )), count. index )} "
364367 protocol = " TCP"
365368 default_action {
0 commit comments