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(push): Add Pub/Sub Subscription support for push payload unwrapping (no wrapper) #141

Closed
wants to merge 11 commits into from
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ module "pubsub" {
x-goog-version = "v1beta1" // optional
oidc_service_account_email = "[email protected]" // optional
audience = "example" // optional
no_wrapper = false // optional
Copy link
Contributor

@apeabody apeabody Aug 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If possible, please add any new variables to an example so they are exercised in the Integration CI: https://github.com/terraform-google-modules/terraform-google-pubsub/tree/master/examples

no_wrapper_write_metadata = false // optional
expiration_policy = "1209600s" // optional
dead_letter_topic = "projects/my-pubsub-project/topics/example-dl-topic" // optional
max_delivery_attempts = 5 // optional
Expand Down
10 changes: 10 additions & 0 deletions examples/subscriptions_only/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,16 @@ module "pubsub" {
ack_deadline_seconds = 20
expiration_policy = "1209600s" // two weeks
},
{
name = "push_payload_unwrapping"
push_endpoint = "https://${var.project_id}.appspot.com/"
no_wrapper = no_wrapper.test.name
ack_deadline_seconds = 20
expiration_policy = "1209600s" // two weeks
},
]
}

resource "no_wrapper" "test" {
write_metadata = true
}
7 changes: 7 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,13 @@ resource "google_pubsub_subscription" "push_subscriptions" {
audience = lookup(each.value, "audience", "")
}
}

dynamic "no_wrapper" {
for_each = (lookup(each.value, "write_metadata", "") != "") ? [each.value.write_metadata] : []
content {
write_metadata = lookup(each.value, "write_metadata", null)
}
}
}
depends_on = [
google_pubsub_topic.topic,
Expand Down