Google bigquery 使用Terraform-WriteDisposition创建BigQuery表

Google bigquery 使用Terraform-WriteDisposition创建BigQuery表,google-bigquery,terraform,Google Bigquery,Terraform,我正在使用Terraform创建许多BigQuery数据集和表。我需要在创建BQ表时传递bigquery.WriteDisposition参数,以便可以截断或追加该表(如果该表已经存在)。否则,我将得到一个错误409,表示该表已经存在并且是重复的 但是,您知道Terraform中是否有传递此参数的选项吗?我看不到任何:-(根据,有写入处理选项。可能的值-写入截断,写入追加,写入空 resource "google_bigquery_table" "foo"

我正在使用Terraform创建许多BigQuery数据集和表。我需要在创建BQ表时传递bigquery.WriteDisposition参数,以便可以截断或追加该表(如果该表已经存在)。否则,我将得到一个错误409,表示该表已经存在并且是重复的

但是,您知道Terraform中是否有传递此参数的选项吗?我看不到任何:-(

根据,有
写入处理
选项。可能的值-
写入截断
写入追加
写入空

resource "google_bigquery_table" "foo" {
  dataset_id = google_bigquery_dataset.bar.dataset_id
  table_id   = "job_load_table"
}

resource "google_bigquery_dataset" "bar" {
  dataset_id                  = "job_load_dataset"
  friendly_name               = "test"
  description                 = "This is a test description"
  location                    = "US"
}

resource "google_bigquery_job" "job" {
  job_id     = "job_load"

  labels = {
    "my_job" ="load"
  }

  load {
    source_uris = [
      "gs://cloud-samples-data/bigquery/us-states/us-states-by-date.csv",
    ]

    destination_table {
      project_id = google_bigquery_table.foo.project
      dataset_id = google_bigquery_table.foo.dataset_id
      table_id   = google_bigquery_table.foo.table_id
    }

    skip_leading_rows = 1
    schema_update_options = ["ALLOW_FIELD_RELAXATION", "ALLOW_FIELD_ADDITION"]

    write_disposition = "WRITE_APPEND"
    autodetect = true
  }
}

不完全是。这里,write_disposition标志被添加到BigQuery作业资源中,而不是添加到BigQuery数据集/表资源中。