title: Deploy a Dataflow with Terraform
body: <p>I'm trying to deploy a Dataflow template with Terraform in GCloud.</p>
  
  <p>There are several tutorial which include some terraform code. There are 2 options:Use <em>module</em> like the following <a href="https://github.com/terraform-google-modules/terraform-google-dataflow/blob/master/examples/dlp_api_example/main.tf" rel="nofollow noreferrer">link</a> or  use <em>resource</em> like the following <a href="https://www.terraform.io/docs/providers/google/r/dataflow_job.html" rel="nofollow noreferrer">link</a> </p>
  
  <p>With both options I have the following error:</p>
  
  <pre><code>Error: googleapi: got HTTP response code 502 with body: &lt;!DOCTYPE html&gt;
  &lt;html lang=en&gt;
    &lt;meta charset=utf-8&gt;
    &lt;meta name=viewport content="initial-scale=1, minimum-scale=1, width=device-width"&gt;
    &lt;title&gt;Error 502 (Server Error)!!1&lt;/title&gt;
    &lt;style&gt;
      *{margin:0;padding:0}html,code{font:15px/22px arial,sans-serif}html{background:#fff;color:#222;padding:15px}body{margin:7% auto 0;max-width:390px;min-height:180px;padding:30px 0 15px}* &gt; body{background:url(//www.google.com/images/errors/robot.png) 100% 5px no-repeat;padding-right:205px}p{margin:11px 0 22px;overflow:hidden}ins{color:#777;text-decoration:none}a img{border:0}@media screen and (max-width:772px){body{background:none;margin-top:0;max-width:none;padding-right:0}}#logo{background:url(//www.google.com/images/branding/googlelogo/1x/googlelogo_color_150x54dp.png) no-repeat;margin-left:-5px}@media only screen and (min-resolution:192dpi){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat 0% 0%/100% 100%;-moz-border-image:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) 0}}@media only screen and (-webkit-min-device-pixel-ratio:2){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat;-webkit-background-size:100% 100%}}#logo{display:inline-block;height:54px;width:150px}
    &lt;/style&gt;
    &lt;a href=//www.google.com/&gt;&lt;span id=logo aria-label=Google&gt;&lt;/span&gt;&lt;/a&gt;
    &lt;p&gt;&lt;b&gt;502.&lt;/b&gt; &lt;ins&gt;That’s an error.&lt;/ins&gt;
    &lt;p&gt;The server encountered a temporary error and could not complete your request.&lt;p&gt;Please try again in 30 seconds.  &lt;ins&gt;That’s all we know.&lt;/ins&gt;
  
  
    on .terraform\modules\dataflow-job\terraform-google-modules-terraform-google-dataflow-722fc1d\main.tf line 17, in resource "google_dataflow_job" "dataflow_job":
    17: resource "google_dataflow_job" "dataflow_job" {
  </code></pre>
  
  <p>I have tried running from my local computer and also from the cloud shell inside GCP.</p>
  
  <p>The problem should be in the dataflow module, because I also tried to create other resource like a bucket and compute engine and it works without any problem.</p>
  
  <p>The dataflow template is storaged in a bucket before I run the terraform script.</p>
  
  <p>Terraform version: 0.12.19</p>
  
  <p>The code:</p>
  
  <p><strong>main.tf</strong></p>
  
  <pre><code>variable "project_id" {}
  &lt;...&gt;
  
  
  provider "google" {
    version = "~&gt; 2.8.0"
    region  = var.region
  }
  
  resource "google_dataflow_job" "dataflow_job" {
    project               = var.project_id
    region                = var.region
    zone                  = "${var.region}-a"
    name                  = var.project_name
    on_delete             = "cancel"
    max_workers           = var.max_workers
    template_gcs_path     = var.template_location
    temp_gcs_location     = "gs://${var.gcs_location}/tmp_dir"
    service_account_email = var.controller_service_account_email
    parameters = {
      inputPubSub       = var.input_PubSub_subscription
      outputPubSub      = var.output_PubSub_subscription
    }
    machine_type     = var.machine_type
  }
  </code></pre>
  
  <p><strong>terraform.tfvars</strong></p>
  
  <pre><code>&lt;...&gt;
  template_location = "gs://www/zzz/template"
  gcs_location= "gs://www/yyy"
  &lt;...&gt;
  </code></pre>
  
  <p><strong>To test if my code is wrong, I also tried directly from the code of <a href="https://github.com/terraform-google-modules/terraform-google-dataflow/blob/master/examples/dlp_api_example/main.tf" rel="nofollow noreferrer">link</a> and also the same error.</strong> </p>
  
  <p>Am I missing any dependence to add to the code?</p>