Skip to content

Commit 28d2e8f

Browse files
committed
feat: introduce connection_id for external_table configuration
1 parent 28accbd commit 28d2e8f

File tree

4 files changed

+6
-1
lines changed

4 files changed

+6
-1
lines changed

examples/multiple_tables/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ module "bigquery" {
7474
max_bad_records = 0
7575
source_format = "CSV"
7676
schema = null
77+
connection_id = null
7778
expiration_time = 2524604400000 # 2050/01/01
7879
labels = {
7980
env = "devops"

main.tf

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ resource "google_bigquery_table" "external_table" {
186186
table_id = each.key
187187
description = each.value["description"]
188188
labels = each.value["labels"]
189+
schema = each.value["connection_id"] != null ? each.value["schema"] : null
189190
expiration_time = each.value["expiration_time"] != null ? each.value["expiration_time"] : 0
190191
max_staleness = each.value["max_staleness"]
191192
project = var.project_id
@@ -194,9 +195,10 @@ resource "google_bigquery_table" "external_table" {
194195
external_data_configuration {
195196
autodetect = each.value["autodetect"]
196197
compression = each.value["compression"]
198+
connection_id = each.value["connection_id"]
197199
ignore_unknown_values = each.value["ignore_unknown_values"]
198200
max_bad_records = each.value["max_bad_records"]
199-
schema = each.value["schema"]
201+
schema = each.value["connection_id"] == null ? each.value["schema"] : null
200202
source_format = each.value["source_format"]
201203
source_uris = each.value["source_uris"]
202204

metadata.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ spec:
185185
ignore_unknown_values = bool,
186186
max_bad_records = number,
187187
schema = string,
188+
connection_id = optional(string),
188189
source_format = string,
189190
source_uris = list(string),
190191
csv_options = object({

variables.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ variable "external_tables" {
199199
ignore_unknown_values = bool,
200200
max_bad_records = number,
201201
schema = string,
202+
connection_id = optional(string),
202203
source_format = string,
203204
source_uris = list(string),
204205
csv_options = object({

0 commit comments

Comments
 (0)