2017-08-13 02:03:01 +02:00
|
|
|
resource "digitalocean_firewall" "rules" {
|
|
|
|
name = "${var.cluster_name}"
|
|
|
|
|
|
|
|
tags = ["${var.cluster_name}-controller", "${var.cluster_name}-worker"]
|
|
|
|
|
|
|
|
# allow ssh, http/https ingress, and peer-to-peer traffic
|
|
|
|
inbound_rule = [
|
|
|
|
{
|
2017-08-13 03:25:05 +02:00
|
|
|
protocol = "tcp"
|
|
|
|
port_range = "22"
|
2017-08-13 02:03:01 +02:00
|
|
|
source_addresses = ["0.0.0.0/0", "::/0"]
|
|
|
|
},
|
|
|
|
{
|
2017-08-13 03:25:05 +02:00
|
|
|
protocol = "tcp"
|
|
|
|
port_range = "80"
|
2017-08-13 02:03:01 +02:00
|
|
|
source_addresses = ["0.0.0.0/0", "::/0"]
|
|
|
|
},
|
|
|
|
{
|
2017-08-13 03:25:05 +02:00
|
|
|
protocol = "tcp"
|
|
|
|
port_range = "443"
|
2017-08-13 02:03:01 +02:00
|
|
|
source_addresses = ["0.0.0.0/0", "::/0"]
|
|
|
|
},
|
|
|
|
{
|
2017-08-13 03:25:05 +02:00
|
|
|
protocol = "udp"
|
|
|
|
port_range = "all"
|
2017-08-13 02:03:01 +02:00
|
|
|
source_tags = ["${var.cluster_name}-controller", "${var.cluster_name}-worker"]
|
|
|
|
},
|
|
|
|
{
|
2017-08-13 03:25:05 +02:00
|
|
|
protocol = "tcp"
|
|
|
|
port_range = "all"
|
2017-08-13 02:03:01 +02:00
|
|
|
source_tags = ["${var.cluster_name}-controller", "${var.cluster_name}-worker"]
|
|
|
|
},
|
|
|
|
]
|
|
|
|
|
|
|
|
# allow all outbound traffic
|
|
|
|
outbound_rule = [
|
|
|
|
{
|
2017-08-13 03:25:05 +02:00
|
|
|
protocol = "icmp"
|
2017-08-13 02:03:01 +02:00
|
|
|
destination_addresses = ["0.0.0.0/0", "::/0"]
|
|
|
|
},
|
|
|
|
{
|
2017-08-13 03:25:05 +02:00
|
|
|
protocol = "udp"
|
|
|
|
port_range = "all"
|
2017-08-13 02:03:01 +02:00
|
|
|
destination_addresses = ["0.0.0.0/0", "::/0"]
|
|
|
|
},
|
|
|
|
{
|
2017-08-13 03:25:05 +02:00
|
|
|
protocol = "tcp"
|
|
|
|
port_range = "all"
|
2017-08-13 02:03:01 +02:00
|
|
|
destination_addresses = ["0.0.0.0/0", "::/0"]
|
|
|
|
},
|
|
|
|
]
|
|
|
|
}
|