Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
243 views
in Technique[技术] by (71.8m points)

google cloud platform - Deploy a Dataflow with Terraform

I'm trying to deploy a Dataflow template with Terraform in GCloud.

There are several tutorial which include some terraform code. There are 2 options:Use module like the following link or use resource like the following link

With both options I have the following error:

Error: googleapi: got HTTP response code 502 with body: <!DOCTYPE html>
<html lang=en>
  <meta charset=utf-8>
  <meta name=viewport content="initial-scale=1, minimum-scale=1, width=device-width">
  <title>Error 502 (Server Error)!!1</title>
  <style>
    *{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}* > 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}
  </style>
  <a href=//www.google.com/><span id=logo aria-label=Google></span></a>
  <p><b>502.</b> <ins>That’s an error.</ins>
  <p>The server encountered a temporary error and could not complete your request.<p>Please try again in 30 seconds.  <ins>That’s all we know.</ins>


  on .terraformmodulesdataflow-job	erraform-google-modules-terraform-google-dataflow-722fc1dmain.tf line 17, in resource "google_dataflow_job" "dataflow_job":
  17: resource "google_dataflow_job" "dataflow_job" {

I have tried running from my local computer and also from the cloud shell inside GCP.

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.

The dataflow template is storaged in a bucket before I run the terraform script.

Terraform version: 0.12.19

The code:

main.tf

variable "project_id" {}
<...>


provider "google" {
  version = "~> 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
}

terraform.tfvars

<...>
template_location = "gs://www/zzz/template"
gcs_location= "gs://www/yyy"
<...>

To test if my code is wrong, I also tried directly from the code of link and also the same error.

Am I missing any dependence to add to the code?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...