Add BigQuery subcriptions to Pubsub module.

Pubsub can now have subscriptions that write directly to BigQuery.
 * https://cloud.google.com/pubsub/docs/bigquery

In the Google Terraform provider, this is configured using an additional block
inside a `google_pubsub_subscription` resource.
 * https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/pubsub_subscription#nested_bigquery_config

This PR adds a new input variable to the `pubsub` module, to optionally add this
block to some of the subscriptions defined in the module.
This commit is contained in:
Israel Herraiz
2022-11-21 17:43:17 +01:00
parent b6249bc52e
commit e692eac867
3 changed files with 59 additions and 14 deletions

View File

@@ -116,6 +116,16 @@ resource "google_pubsub_subscription" "default" {
}
}
}
dynamic "bigquery_config" {
for_each = try(var.bigquery_subscription_configs[each.key], null) == null ? [] : [""]
content {
table = var.bigquery_subscription_configs[each.key].table
use_topic_schema = var.bigquery_subscription_configs[each.key].use_topic_schema
write_metadata = var.bigquery_subscription_configs[each.key].write_metadata
drop_unknown_fields = var.bigquery_subscription_configs[each.key].drop_unknown_fields
}
}
}
resource "google_pubsub_subscription_iam_binding" "default" {