From c1083a640008d90ba1826682bf42587a44e9f8a1 Mon Sep 17 00:00:00 2001 From: Lauren Huang Date: Fri, 17 May 2024 20:11:32 +0000 Subject: [PATCH 1/3] feat: add support for setting filename_datetime_format --- README.md | 17 +++++++++-------- main.tf | 11 ++++++----- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 7abc56c..80e2453 100644 --- a/README.md +++ b/README.md @@ -62,14 +62,15 @@ module "pubsub" { ] cloud_storage_subscriptions = [ { - name = "cloud-storage" // required - bucket = "example-bucket" // required - filename_prefix = "log_events_" // optional - filename_suffix = ".avro" // optional - max_duration = "60s" // optional - max_bytes = "10000000" // optional - output_format = "avro" // optional - write_metadata = false // optional + name = "cloud-storage" // required + bucket = "example-bucket" // required + filename_prefix = "log_events_" // optional + filename_suffix = ".avro" // optional + filename_datetime_format = "YYYY-MM-DD/hh_mm_ssZ" // optional + max_duration = "60s" // optional + max_bytes = "10000000" // optional + output_format = "avro" // optional + write_metadata = false // optional } ] } diff --git a/main.tf b/main.tf index 641b10f..fa04f28 100644 --- a/main.tf +++ b/main.tf @@ -434,11 +434,12 @@ resource "google_pubsub_subscription" "cloud_storage_subscriptions" { } cloud_storage_config { - bucket = each.value["bucket"] - filename_prefix = lookup(each.value, "filename_prefix", null) - filename_suffix = lookup(each.value, "filename_suffix", null) - max_duration = lookup(each.value, "max_duration", null) - max_bytes = lookup(each.value, "max_bytes", null) + bucket = each.value["bucket"] + filename_prefix = lookup(each.value, "filename_prefix", null) + filename_suffix = lookup(each.value, "filename_suffix", null) + filename_datetime_format = lookup(each.value, "filename_datetime_format", null) + max_duration = lookup(each.value, "max_duration", null) + max_bytes = lookup(each.value, "max_bytes", null) dynamic "avro_config" { for_each = (lookup(each.value, "output_format", "") == "avro") ? [true] : [] content { From c223a9788504f109808cd8e6663e0aa8041914af Mon Sep 17 00:00:00 2001 From: Lauren Huang Date: Wed, 29 May 2024 21:16:03 +0000 Subject: [PATCH 2/3] Force min google provider version to 5.31 --- examples/cloud_storage/main.tf | 3 +++ 1 file changed, 3 insertions(+) diff --git a/examples/cloud_storage/main.tf b/examples/cloud_storage/main.tf index b2ab735..c65beeb 100644 --- a/examples/cloud_storage/main.tf +++ b/examples/cloud_storage/main.tf @@ -38,6 +38,9 @@ module "pubsub" { name = "example_bucket_subscription" bucket = google_storage_bucket.test.name + filename_prefix = "example_prefix_" + filename_suffix = "_example_suffix" + filename_datetime_format = "YYYY-MM-DD/hh_mm_ssZ" ack_deadline_seconds = 300 }, ] From d3fde2fea25b56bbdc4f3b744497f29cf108510b Mon Sep 17 00:00:00 2001 From: Lauren Huang Date: Wed, 29 May 2024 21:23:01 +0000 Subject: [PATCH 3/3] Force min google provider version to 5.31 --- test/setup/versions.tf | 4 ++-- versions.tf | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/test/setup/versions.tf b/test/setup/versions.tf index f106432..d1a102e 100644 --- a/test/setup/versions.tf +++ b/test/setup/versions.tf @@ -19,11 +19,11 @@ terraform { required_providers { google = { source = "hashicorp/google" - version = ">= 4.78" + version = ">= 5.31" } google-beta = { source = "hashicorp/google-beta" - version = ">= 4.78" + version = ">= 5.31" } null = { source = "hashicorp/null" diff --git a/versions.tf b/versions.tf index f601327..d8860e2 100644 --- a/versions.tf +++ b/versions.tf @@ -20,7 +20,7 @@ terraform { google = { source = "hashicorp/google" - version = ">= 4.78, < 6" + version = ">= 5.31, < 6" } }