Skip to content

Commit 46a264b

Browse files
lahuang4Lauren Huangimrannayer
authored
feat(TPG>=5.31)!: add cloud storage filename datetime format support (#192)
Co-authored-by: Lauren Huang <laurenhuang@google.com> Co-authored-by: Imran Nayer <imrannayer@google.com>
1 parent c310330 commit 46a264b

File tree

5 files changed

+21
-16
lines changed

5 files changed

+21
-16
lines changed

‎README.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,15 @@ module "pubsub" {
6363
]
6464
cloud_storage_subscriptions = [
6565
{
66-
name = "cloud-storage" // required
67-
bucket = "example-bucket" // required
68-
filename_prefix = "log_events_" // optional
69-
filename_suffix = ".avro" // optional
70-
max_duration = "60s" // optional
71-
max_bytes = "10000000" // optional
72-
output_format = "avro" // optional
73-
write_metadata = false // optional
66+
name = "cloud-storage" // required
67+
bucket = "example-bucket" // required
68+
filename_prefix = "log_events_" // optional
69+
filename_suffix = ".avro" // optional
70+
filename_datetime_format = "YYYY-MM-DD/hh_mm_ssZ" // optional
71+
max_duration = "60s" // optional
72+
max_bytes = "10000000" // optional
73+
output_format = "avro" // optional
74+
write_metadata = false // optional
7475
}
7576
]
7677
}

‎examples/cloud_storage/main.tf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ module "pubsub" {
3838
name = "example_bucket_subscription"
3939
bucket = google_storage_bucket.test.name
4040

41+
filename_prefix = "example_prefix_"
42+
filename_suffix = "_example_suffix"
43+
filename_datetime_format = "YYYY-MM-DD/hh_mm_ssZ"
4144
ack_deadline_seconds = 300
4245
},
4346
]

‎main.tf

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -439,11 +439,12 @@ resource "google_pubsub_subscription" "cloud_storage_subscriptions" {
439439
}
440440

441441
cloud_storage_config {
442-
bucket = each.value["bucket"]
443-
filename_prefix = lookup(each.value, "filename_prefix", null)
444-
filename_suffix = lookup(each.value, "filename_suffix", null)
445-
max_duration = lookup(each.value, "max_duration", null)
446-
max_bytes = lookup(each.value, "max_bytes", null)
442+
bucket = each.value["bucket"]
443+
filename_prefix = lookup(each.value, "filename_prefix", null)
444+
filename_suffix = lookup(each.value, "filename_suffix", null)
445+
filename_datetime_format = lookup(each.value, "filename_datetime_format", null)
446+
max_duration = lookup(each.value, "max_duration", null)
447+
max_bytes = lookup(each.value, "max_bytes", null)
447448
dynamic "avro_config" {
448449
for_each = (lookup(each.value, "output_format", "") == "avro") ? [true] : []
449450
content {

‎test/setup/versions.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ terraform {
1919
required_providers {
2020
google = {
2121
source = "hashicorp/google"
22-
version = ">= 4.78"
22+
version = ">= 5.31"
2323
}
2424
google-beta = {
2525
source = "hashicorp/google-beta"
26-
version = ">= 4.78"
26+
version = ">= 5.31"
2727
}
2828
null = {
2929
source = "hashicorp/null"

‎versions.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ terraform {
2020

2121
google = {
2222
source = "hashicorp/google"
23-
version = ">= 4.78, < 6"
23+
version = ">= 5.31, < 6"
2424
}
2525
}
2626

0 commit comments

Comments
 (0)