1

这更多是关于可能性的问题,因为 GCP 上没有关于此的文档。我正在使用 BigQuery DTS 将我的 CSV 从 GCS 存储桶移动到 BQ 表。我已经手动尝试过了,它可以工作,但我需要一些自动化,并希望使用 Terraform 来实现它。我已经检查过这个链接,但它并没有帮助: https ://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/bigquery_data_transfer_config

任何帮助,将不胜感激。谢谢!

4

1 回答 1

2

我认为问题在于文档没有列出参数。这是一个例子。与 API 进行比较。

https://cloud.google.com/bigquery-transfer/docs/cloud-storage-transfer#bq

resource "google_bigquery_data_transfer_config" "sample" {
  display_name           = "sample"
  location               = "asia-northeast1"
  data_source_id         = "google_cloud_storage"
  schedule               = "every day 10:00"
  destination_dataset_id = "target_dataset"
  params = {
    data_path_template              = "gs://target_bucket/*"
    destination_table_name_template = "target_table"
    file_format                      = "CSV"
    write_disposition               = "MIRROR"
    max_bad_records                 = 0
    ignore_unknown_values           = "false"
    field_delimiter                  = ","
    skip_leading_rows               = "1"
    allow_quoted_newlines           = "false"
    allow_jagged_rows               = "false"
    delete_source_files              = "false"
  }
}
于 2021-12-08T21:47:52.030 回答