From 24f911ac90071bc18d743c774649beb0082108a4 Mon Sep 17 00:00:00 2001
From: mdaddetta <144601485+mdaddetta@users.noreply.github.com>
Date: Thu, 13 Jun 2024 00:36:19 +0200
Subject: [PATCH] Add use_table_schema parameter for PubSub subscription to
BigQuery (#2357)
---
modules/pubsub/README.md | 2 +-
modules/pubsub/main.tf | 1 +
modules/pubsub/variables.tf | 1 +
3 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/modules/pubsub/README.md b/modules/pubsub/README.md
index 856deab1b9..e9a8e9e177 100644
--- a/modules/pubsub/README.md
+++ b/modules/pubsub/README.md
@@ -174,7 +174,7 @@ module "pubsub" {
| [message_retention_duration](variables.tf#L67) | Minimum duration to retain a message after it is published to the topic. | string
| | null
|
| [regions](variables.tf#L83) | List of regions used to set persistence policy. | list(string)
| | []
|
| [schema](variables.tf#L90) | Topic schema. If set, all messages in this topic should follow this schema. | object({…})
| | null
|
-| [subscriptions](variables.tf#L100) | Topic subscriptions. Also define push configs for push subscriptions. If options is set to null subscription defaults will be used. Labels default to topic labels if set to null. | map(object({…}))
| | {}
|
+| [subscriptions](variables.tf#L100) | Topic subscriptions. Also define push configs for push subscriptions. If options is set to null subscription defaults will be used. Labels default to topic labels if set to null. | map(object({…}))
| | {}
|
## Outputs
diff --git a/modules/pubsub/main.tf b/modules/pubsub/main.tf
index a090f861b0..575278094d 100644
--- a/modules/pubsub/main.tf
+++ b/modules/pubsub/main.tf
@@ -104,6 +104,7 @@ resource "google_pubsub_subscription" "default" {
for_each = each.value.bigquery == null ? [] : [""]
content {
table = each.value.bigquery.table
+ use_table_schema = each.value.bigquery.use_table_schema
use_topic_schema = each.value.bigquery.use_topic_schema
write_metadata = each.value.bigquery.write_metadata
drop_unknown_fields = each.value.bigquery.drop_unknown_fields
diff --git a/modules/pubsub/variables.tf b/modules/pubsub/variables.tf
index 6ea20f6d52..a314848ad7 100644
--- a/modules/pubsub/variables.tf
+++ b/modules/pubsub/variables.tf
@@ -118,6 +118,7 @@ variable "subscriptions" {
}))
bigquery = optional(object({
table = string
+ use_table_schema = optional(bool, false)
use_topic_schema = optional(bool, false)
write_metadata = optional(bool, false)
drop_unknown_fields = optional(bool, false)