For people who are confused with my question.
My goal is to achieve:
resource "aws_lb_listener_rule" "https" {
...
condition {
host_header {
values = []
}
condition {
path_pattern {
values = []
}
}
I thought that I could achieve it with labels in the dynamic block to override the dynamic host_header with either host_header or path_pattern in labels:
resource "aws_lb_listener_rule" "https" {
...
dynamic "condition" {
for_each = local.condition
content {
dynamic "host_header" {
for_each = local.condition
labels = ["host_header", "path_header"]
content {
values = condition.values.values
}
}
}
}
The suggestion from @stuart-c is how I will go about doing it.