【问题标题】:terraform gcp dataflow job is giving me error about name?terraform gcp 数据流作业给我关于名称的错误?
【发布时间】:2018-10-26 14:33:12
【问题描述】:

这是我正在使用的 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.

【问题讨论】:

  • 您是否尝试过将 parameters.name 字段更改为 appName?

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


【解决方案1】:

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

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

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

inputFile 云存储输入文件路径。 output Cloud Storage 输出文件路径和前缀。

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

【讨论】:

    猜你喜欢
    • 2020-08-05
    • 2021-01-22
    • 1970-01-01
    • 1970-01-01
    • 2023-01-09
    • 2021-10-17
    • 2022-10-13
    • 2022-12-20
    • 1970-01-01
    相关资源
    最近更新 更多