terraform gcp dataflow工作给我一个关于名字的错误?

时间:2018-05-16 13:41:30

标签: google-cloud-platform google-cloud-dataflow terraform

这是我正在使用的地形。

  provider "google" {
      credentials = "${file("${var.credentials}")}"
      project     = "${var.gcp_project}"
      region      = "${var.region}"
    }

    resource "google_dataflow_job" "big_data_job" {
      #name = "${var.job_name}"
      template_gcs_path = "gs://dataflow-templates/wordcount/template_file"
      #template_gcs_path = "gs://dataflow-samples/shakespeare/kinglear.txt"
      temp_gcs_location = "gs://bucket-60/counts"
      max_workers       = "${var.max-workers}"
      project           = "${var.gcp_project}"
      zone              = "${var.zone}"
      parameters {
        name = "cloud_dataflow"
      }
    }

但是我收到了这个错误。我怎么能解决这个问题: - 在此输入代码错误:应用计划时出错:

1 error(s) occurred:

* google_dataflow_job.big_data_job: 1 error(s) occurred:

* google_dataflow_job.big_data_job: googleapi: Error 400: (4ea5c17a2a9d21ab): The workflow could not be created. Causes: (4ea5c17a2a9d2052): Found unexpected parameters: ['name' (perhaps you meant 'appName')], badRequest

Terraform does not automatically rollback in the face of errors.
Instead, your Terraform state file has been partially updated with
any resources that successfully completed. Please address the error
above and apply again to incrementally change your infrastructure.

1 个答案:

答案 0 :(得分:0)

在您的代码中,您已注释掉name参数,但对此资源类型却注释了name is required

  
      
  1. 从此行中删除前导#
  2.   
#name = "${var.job_name}"

您还已经将name作为数据流模板的参数,但该示例wordcount模板没有name参数it only has inputFile and output

inputFile Cloud Storage输入文件路径。 output Cloud Storage输出文件的路径和前缀。

  
      
  1. 删除此部分:
  2.   
parameters {
    name = "cloud_dataflow"
}