I am trying to setting up subnets per AZs within regions. This is my aws_subnet resource:
resource "aws_subnet" "internal" {
count = "${length(split(",", lookup(var.aws_azs, var.region)))}"
cidr_block = "${element(var.subnet_int_cidr, count.index)}"
availability_zone = "${element((lookup(var.aws_azs,var.region)),count.index)}"
tags {
Name = "${var.subnet_int_name}${count.index + 1}"
}
}
When I issue "terraform plan" it prints the following error:
$ terraform plan
Error configuring: 2 error(s) occurred:
* lookup: lookup() may only be used with flat maps, this map contains elements of type list in:
${length(split(",", lookup(var.aws_azs, var.region)))}
Could be this a new feature or there is another solution?
Regards.