Skip to content

Instantly share code, notes, and snippets.

@Simonx123
Forked from Callonski/firewall_rules.tf
Created September 7, 2020 00:58
Show Gist options
  • Select an option

  • Save Simonx123/8f23d8949153198299fd45d27843353c to your computer and use it in GitHub Desktop.

Select an option

Save Simonx123/8f23d8949153198299fd45d27843353c to your computer and use it in GitHub Desktop.
resource "google_compute_firewall" "allow-all-internal" {
name = "allow-all-internal"
network = google_compute_network.my-elastic-network.name
allow {
protocol = "tcp"
}
allow {
protocol = "udp"
}
allow {
protocol = "icmp"
}
source_ranges = ["x.x.x.x/x"] // your subnet IP range
}
resource "google_compute_firewall" "allow-internal-lb" {
name = "allow-internal-lb"
network = google_compute_network.my-elastic-network.name
allow {
protocol = "tcp"
ports = var.ports_to_open
}
source_ranges = ["x.x.x.x/x"] // your subnet IP range
target_tags = var.network_tags
}
resource "google_compute_firewall" "allow-health-check" {
name = "allow-health-check"
network = google_compute_network.my-elastic-network.name
allow {
protocol = "tcp"
ports = var.ports_to_open
}
source_ranges = ["x.x.x.x/x"] // your subnet IP range
target_tags = var.network_tags
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment