Using TF 0.12.20 I am trying to pass along arguments to a custom module where I use dynamic blocks.
load_balancers = [{
target_group_arn = data.aws_lb_target_group.syslog.arn
container_name = local.container_name
container_port = 10514
}]
In the module I define a balancers variables like:
variable "load_balancers" {
type = list(map(any))
default = []
}
And my dynamic block looks like:
dynamic "load_balancer" {
for_each = var.load_balancers
content {
elb_name = lookup(load_balancer, "elb_name", null)
target_group_arn = lookup(load_balancer, "target_group_arn", null)
container_name = load_balancer.value["container_name"]
container_port = load_balancer.value["container_port"]
}
}
The issue is with the lookup method. It always return nulle and skip adding target_group_arn or elb_name even if I provide a value into the object I pass along as argument. Any suggestion?