After days of staring at the code and Googling everywhere, I figured out my issue. The module I’m using turns the records into a map with the tomap
function. I used code from another post I found on here, but then I realized I didn’t need the for loop within locals
. Once I removed it, everything works as expected.
Updated code that works:
locals {
zone_data_raw = yamldecode(file("${path.module}//zone_data.yaml"))
}
module "records" {
source = "terraform-aws-modules/route53/aws//modules/records"
zone_id = local.zone_data_raw.zone_id
private_zone = true
records = local.zone_data_raw.records
}