From b7c42ff71887f3ae0338f6343265ab7779b5442b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Sauv=C3=A8re?= Date: Thu, 8 Aug 2024 09:57:23 +0200 Subject: [PATCH] feat: add support for `require_partition_filter` in the external tables --- examples/multiple_tables/main.tf | 3 ++- main.tf | 5 +++-- variables.tf | 5 +++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/examples/multiple_tables/main.tf b/examples/multiple_tables/main.tf index 39a9bf5e..db4d71a4 100644 --- a/examples/multiple_tables/main.tf +++ b/examples/multiple_tables/main.tf @@ -116,7 +116,8 @@ module "bigquery" { ] csv_options = null hive_partitioning_options = { - mode = "AUTO" + mode = "AUTO" + require_partition_filter = true # DO NOT CHANGE - see above source_uris source_uri_prefix = "gs://ci-bq-external-data/hive_partition_example/" } diff --git a/main.tf b/main.tf index aa7a6297..d239ac12 100644 --- a/main.tf +++ b/main.tf @@ -220,8 +220,9 @@ resource "google_bigquery_table" "external_table" { dynamic "hive_partitioning_options" { for_each = each.value["hive_partitioning_options"] != null ? [each.value["hive_partitioning_options"]] : [] content { - mode = hive_partitioning_options.value["mode"] - source_uri_prefix = hive_partitioning_options.value["source_uri_prefix"] + mode = hive_partitioning_options.value["mode"] + source_uri_prefix = hive_partitioning_options.value["source_uri_prefix"] + require_partition_filter = hive_partitioning_options.value["require_partition_filter"] } } } diff --git a/variables.tf b/variables.tf index 68a0667d..c1a9b2af 100644 --- a/variables.tf +++ b/variables.tf @@ -191,8 +191,9 @@ variable "external_tables" { skip_leading_rows = number, }), hive_partitioning_options = object({ - mode = string, - source_uri_prefix = string, + mode = string, + source_uri_prefix = string, + require_partition_filter = optional(bool), }), expiration_time = string, max_staleness = optional(string),