locals {
cdt_addresses = [for sites in var.cdt_sites : toset("\"${sites.address}\", \"www.${var.cdt_env_url_prefix}${sites.address}\", \"${var.cdt_env_url_prefix}${sites.address}\"")]
}
output "cdt_addresses" {
value = local.cdt_addresses
}
resource "aws_lb_listener_rule" "cdt-apache" {
for_each = local.cdt_addresses
listener_arn = aws_lb_listener.alb_https.arn
action {
type = "forward"
target_group_arn = aws_lb_target_group.cdt_apache_tg.arn
}
condition {
host_header {
values = ["${each.key}"]
}
}
}
I would expect the output to look like this:
cdt_addresses = [
+ ""somesite.com", "www.somesite.com", "prod.somesite.com"",
+ ""someothersite.com", "www.someothersite.com", "prod.someothersite.com"",
]
Instead I get:
cdt_addresses = [
+ "\"somesite.com\", \"www.somesite.com\", \"prod.somesite.com\"",
+ "\"someothersite.com\", \"www.someothersite.com\", \"prod.someothersite.com\"",
]
I have also tried triple backslashes too.
What am I missing here?