Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(TPG>=5.31)!: add cloud storage filename datetime format support #192

Merged
merged 4 commits into from
Jun 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,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
}
]
}
Expand Down
3 changes: 3 additions & 0 deletions examples/cloud_storage/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
},
]
Expand Down
11 changes: 6 additions & 5 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -439,11 +439,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 {
Expand Down
4 changes: 2 additions & 2 deletions test/setup/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ terraform {

google = {
source = "hashicorp/google"
version = ">= 4.78, < 6"
version = ">= 5.31, < 6"
}
}

Expand Down