Aws route53 multiple counts

I have a resource like this, where I need to mention multiple counts one is to trigger the resource based on condition other count is to apply the same value to all my records

variable enable {
default = true
}

variable “records”{
default = example1.com, example2.com, example3.com
}

resource “aws_route53_record” “www” {
count = length(var.record_set_name)

zone_id = var.private_zone_id
name = var.records[count.index]
type = “A”
count = var.enable ? 1 : 0

alias {
name = var.elb_hostname
zone_id = “${data.aws_elb_hosted_zone_id.main.id}”
evaluate_target_health = true
}
}

count = var.enable ? length(var.record_set_name) : 0

Thanks @bentterp, It worked. :slight_smile: