rule.tf 529 Bytes
Newer Older
1
# whitelist an IP
Mike Horwath's avatar
Mike Horwath committed
2
resource "cloudflare_access_rule" "whitelisted_ip" {
3 4
  count = "${length(var.whitelist_ips)}"
  notes = "${var.notes}"
Mike Horwath's avatar
Mike Horwath committed
5 6
  mode  = "whitelist"

7
  configuration {
Mike Horwath's avatar
Mike Horwath committed
8
    target = "ip_range"
9
    value  = "${element(var.whitelist_ips, count.index)}"
Mike Horwath's avatar
Mike Horwath committed
10 11
  }
}
12 13 14

# blacklist an IP
resource "cloudflare_access_rule" "blacklisted_ip" {
15 16
  count = "${length(var.blacklist_ips)}"
  notes = "${var.notes}"
17 18
  mode  = "block"

19
  configuration {
20
    target = "ip_range"
21
    value  = "${element(var.blacklist_ips, count.index)}"
22 23
  }
}