resource "aws_wafregional_ipset" "admin_remote_ipset" {
  name               = "${var.waf_prefix}-generic-match-admin-remote-ip"
  dynamic ip_set_descriptor {
    for_each = var.admin_remote_ipset

    content {
      type  = "IPV4"
      value = ip_set_descriptor.value["value"]
    }
  }
}

resource "aws_wafregional_ipset" "blacklisted_ips" {
  name               = "${var.waf_prefix}-generic-match-blacklisted-ips"
  dynamic ip_set_descriptor {
    for_each = var.blacklisted_ips

    content {
      type  = "IPV4"
      value = ip_set_descriptor.value["value"]
    }
  }
}
