Google bigquery Terraform 0.12.5 | Bigquery表资源不';不支持外部数据配置块

Google bigquery Terraform 0.12.5 | Bigquery表资源不';不支持外部数据配置块,google-bigquery,terraform,external-tables,terraform-provider-gcp,Google Bigquery,Terraform,External Tables,Terraform Provider Gcp,我正在创建一个模块,以便于在GCP中提供BigQuery表。 我的模块正在工作,但现在我尝试添加一个选项,以创建基于外部数据的表,如GCS存储桶 在文档()中,我们说支持此配置,但我只得到以下错误: Acquiring state lock. This may take a few moments... Error: Unsupported block type on ../../modules/bq_table/main.tf line 24, in resource "google_

我正在创建一个模块,以便于在GCP中提供BigQuery表。 我的模块正在工作,但现在我尝试添加一个选项,以创建基于外部数据的表,如GCS存储桶

在文档()中,我们说支持此配置,但我只得到以下错误:

Acquiring state lock. This may take a few moments...

Error: Unsupported block type

  on ../../modules/bq_table/main.tf line 24, in resource "google_bigquery_table" "default":
  24:   external_data_configuration {

Blocks of type "external_data_configuration" are not expected here.
我在Mac OS中使用最新的Terraform版本(0.12.5)和google provider v2.10.0

以下是我在HCL2中的模块代码:

resource "google_bigquery_table" "default" {
  dataset_id  = "${terraform.workspace}_${var.bq_dataset_id}"
  table_id    = "${terraform.workspace}_${var.bq_table_id}"
  project     = (var.project_id != "" ? var.project_id : null)
  description = (var.bq_table_description != "" ? var.project_id : null)
  expiration_time = (var.bq_table_expiration_time != null ? var.project_id : null)
  friendly_name = (var.bq_table_name != "" ? var.project_id : null)

  dynamic "external_data_configuration" {
    for_each = var.bq_table_external_data_configuration
    content {
      autodetect = true
      source_format = "NEWLINE_DELIMITED_JSON"
      source_uris = [external_data_configuration.value]
    }
  }

  time_partitioning {
    type = "DAY"
    field = var.bq_table_partition_field
  }

  labels = var.bq_table_labels

  schema = (var.bq_table_schema != "" ? var.bq_table_schema : null)

  dynamic "view" {
    for_each = (var.bq_table_view_query != "" ? {query = var.bq_table_view_query} : {})
    content {
      query = view.value
    }
  }

  depends_on = ["null_resource.depends_on"]
}

上面的im使用动态块,但尝试正常使用,错误相同。

动态
块中的
for\u每个
属性需要一个数组值。尝试将输入变量包装到数组中:

dynamic "external_data_configuration" {
    for_each = var.bq_table_external_data_configuration ? [var.bq_table_external_data_configuration] : []
    content {
      autodetect = true
      source_format = "NEWLINE_DELIMITED_JSON"
      source_uris = [external_data_configuration.value]
    }
}

即使在Terraform 0.12之后,条件块仍然有点麻烦;阅读了解更多信息。

块中的
for_每个
属性都需要一个数组值。尝试将输入变量包装到数组中:

dynamic "external_data_configuration" {
    for_each = var.bq_table_external_data_configuration ? [var.bq_table_external_data_configuration] : []
    content {
      autodetect = true
      source_format = "NEWLINE_DELIMITED_JSON"
      source_uris = [external_data_configuration.value]
    }
}
即使在Terraform 0.12之后,条件块仍然有点麻烦;阅读更多