Skip to content

Instantly share code, notes, and snippets.

@magickatt
Last active October 22, 2020 14:52
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save magickatt/ec214a6a1ae5ba4d59d8c0ee30167f60 to your computer and use it in GitHub Desktop.
Cloud IAP Terraform firewall rule for GKE
resource "google_compute_firewall" "allow_nodes_from_cloud_iap" {
name = "allow-gke-nodes-ssh-from-cloud-iap"
description = "Allow Cloud IAP to communicate with the the GKE nodes."
network = var.network
allow {
protocol = "tcp"
ports = ["22"]
}
# https://cloud.google.com/iap/docs/using-tcp-forwarding#create-firewall-rule
source_ranges = ["35.235.240.0/20"]
target_tags = ["k8s-node"]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment