It is very simple to create a firewall rule in GCP using Terraform, simply copy the following code in your

  resource "google_compute_firewall" "default" {
  name    = "ssh-rule"
  network = "vpc-peaccce-d-new-dev-bada"
   project  = trimprefix(, "projects/")

  allow {
    protocol = "tcp"
    ports    = ["80", "8080", "22","443"]


If you are looking for setting up GCP workloads using Terraform, we can definitely help you in the most efficient and economical way. We will provide you good solution based on industry best practices.