Hello awesome Terraform community! Could someone share opinion on this?
In my data.tf file, I have
data aws_lb load_balancer_5xx {
for_each = local.config.server.http_5xx_error
name = local.service_load_balancer[each.key]
}
In my configs.tf file, I have
environment = {
amr = {
service_1 = "service_1-lb"
service_2 = "service_2-lb"
service_3 = "service_3-lb"
}
eu = {
service_1 = "service_1-lb"
service_2 = "service_2-lb"
service_3 = "service_3-lb"
}
}
...
load_balancer_prefix = {
service_1 = "${environment[var.region]["service_1"]}"
service_2 = "${environment[var.region]["service_2"]}"
service_3 = "${environment[var.region]["service_3"]}"
}
Now service_3 is not deployed in EU, so the Terraform run gives me a load-balancer-not-found error.
For the “data aws_lb load_balancer_5xx” function in data.tf file, is there a way to do for each but excludes service_3 in eu region?
Thanks