terraform required field is not set with a dynamic list of blocks

178 views Asked by At

I have encountered this terraform issue that seems like a bug, but hoping someone can suggest an alternative way of doing this. This is for v0.11 (unfortunately upgrading is not an option)

I am trying to have a dynamic list of VPC blocks based on the module input

resource "aws_route53_zone" "private_zone" {
  name    = "${var.domain}"
  comment = "Private zone"

  # this works
  # vpc = [
  #  {
  #    vpc_id = "${var.vpc_id}"
  #  },
  # ]

  # this works
  # vpc = ["${list(map("vpc_id", "hello"))}"]

  # this does not
  vpc = ["${list(map("vpc_id", "${var.vpc_id}"))}"]
}

This yields the following:

Error: "vpc.0.vpc_id": required field is not set

I am trying to have a dynamic list of vpc's, so something like:

vpc = ["${concat(
    list(map("vpc_id", "${var.vpc_id}")),
    var.additional_route53_vpc_associations
  )}"]

but this gets the same error.

0

There are 0 answers