Skip to content

Commit

Permalink
fix: ensure the module does not instantiate an empty condition block (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
jhosteny authored Jan 28, 2021
1 parent 1f002c0 commit 8b5f474
Showing 1 changed file with 37 additions and 25 deletions.
62 changes: 37 additions & 25 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,16 @@ resource "aws_lb_listener_rule" "unauthenticated_paths" {
}
}

condition {
dynamic "http_header" {
for_each = var.listener_http_header_conditions

content {
http_header_name = http_header.value["name"]
values = http_header.value["value"]
dynamic "condition" {
for_each = length(var.listener_http_header_conditions) > 0 ? [""] : []
content {
dynamic "http_header" {
for_each = var.listener_http_header_conditions

content {
http_header_name = http_header.value["name"]
values = http_header.value["value"]
}
}
}
}
Expand Down Expand Up @@ -104,13 +107,16 @@ resource "aws_lb_listener_rule" "authenticated_paths_oidc" {
}
}

condition {
dynamic "http_header" {
for_each = var.listener_http_header_conditions
dynamic "condition" {
for_each = length(var.listener_http_header_conditions) > 0 ? [""] : []
content {
dynamic "http_header" {
for_each = var.listener_http_header_conditions

content {
http_header_name = http_header.value["name"]
values = http_header.value["value"]
content {
http_header_name = http_header.value["name"]
values = http_header.value["value"]
}
}
}
}
Expand Down Expand Up @@ -144,13 +150,16 @@ resource "aws_lb_listener_rule" "authenticated_paths_cognito" {
}
}

condition {
dynamic "http_header" {
for_each = var.listener_http_header_conditions
dynamic "condition" {
for_each = length(var.listener_http_header_conditions) > 0 ? [""] : []
content {
dynamic "http_header" {
for_each = var.listener_http_header_conditions

content {
http_header_name = http_header.value["name"]
values = http_header.value["value"]
content {
http_header_name = http_header.value["name"]
values = http_header.value["value"]
}
}
}
}
Expand Down Expand Up @@ -258,13 +267,16 @@ resource "aws_lb_listener_rule" "unauthenticated_hosts_paths" {
}
}

condition {
dynamic "http_header" {
for_each = var.listener_http_header_conditions
dynamic "condition" {
for_each = length(var.listener_http_header_conditions) > 0 ? [""] : []
content {
dynamic "http_header" {
for_each = var.listener_http_header_conditions

content {
http_header_name = http_header.value["name"]
values = http_header.value["value"]
content {
http_header_name = http_header.value["name"]
values = http_header.value["value"]
}
}
}
}
Expand Down

0 comments on commit 8b5f474

Please sign in to comment.