Skip to content

Instantly share code, notes, and snippets.

@syntaqx
Created April 30, 2019 13:42
Show Gist options
  • Save syntaqx/8efb79855aa7f02d6f5844006e1e765f to your computer and use it in GitHub Desktop.
Save syntaqx/8efb79855aa7f02d6f5844006e1e765f to your computer and use it in GitHub Desktop.
resource "digitalocean_firewall" "web" {
name = "test-firewall"
droplet_ids = ["${digitalocean_droplet.web.id}"]
inbound_rule {
protocol = "icmp"
source_addresses = ["0.0.0.0/0", "::/0"]
}
inbound_rule {
protocol = "tcp"
port_range = "80"
source_addresses = ["0.0.0.0/0", "::/0"]
}
inbound_rule {
protocol = "tcp"
port_range = "8080"
source_addresses = ["0.0.0.0/0", "::/0"]
}
inbound_rule {
protocol = "tcp"
port_range = "1000-2000"
source_addresses = ["0.0.0.0/0", "::/0"]
}
}
resource "google_compute_firewall" "default" {
name = "test-firewall"
network = "${google_compute_network.default.name}"
allow {
protocol = "icmp"
}
allow {
protocol = "tcp"
ports = ["80", "8080", "1000-2000"]
}
source_tags = ["web"]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment