how do you turn nested arrays in terraform?

Given the way you’ve set up the for_each in this example, each.value in that block will be the corresponding object from your local.cname map, so you can access the records attribute of that object in the usual way:

resource "aws_route53_record" "cname" {
  for_each = local.cname
  name     = each.key
  records  = each.value.records
  ttl      = 300
  type     = "CNAME"
  zone_id  = aws_route53_zone.example.zone_id
}

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top