title: With Terraform, how to create a google firewall from port to port
body: <p>I have already created firewall (security groups) on AWS using the feature from_port/to_port.
  For exemple, here I create a SG from port 5000 to port 5100, from port 6000 to 6100, from port 7000 to 7100 ...</p>
  
  <pre><code>variable "list_port" {
      type = "list"
      default = [
      "5000-5100",
      "6000-6100",
      "7000-7100",
    ]
  }
  
  resource "aws_security_group" "test" {
    name     = "test"
  }
  
  resource "aws_security_group_rule" "test" {
    count             = "${length(var.list_port)}"
    type              = "ingress"
    from_port         = "${ element(split("-", element(var.list_port, count.index)), 0) }"
    to_port           = "${ element(split("-", element(var.list_port, count.index)), 1) }"
    protocol          = "TCP"
    cidr_blocks       = ["0.0.0.0/0"]
    security_group_id = "${aws_security_group.test.id}"
  }
  </code></pre>
  
  <p>I'm trying to do the same thing with google, but it seems there is no from_to options.
  I want to be the more DRY possible and not repeat the ports. An other good reason is that I'm using terraform module with a variable containing ports to open.
  So I want to avoid something like that.</p>
  
  <pre><code>resource "google_compute_firewall" "firewall" {
    name          = "test"
    direction     = "INGRESS"
    allow {
      protocol = "tcp"
      ports    = [5000, 5100]
    }
    allow {
      protocol = "tcp"
      ports    = [6000, 6100]
    }
    allow {
      protocol = "tcp"
      ports    = [7000, 7100]
    }
  
  } 
  </code></pre>
  
  <p>Does anyone known a better solution ?</p>
  
  <p>Thanks</p>
  
  <p>BR,</p>
  
  <p>Eric</p>