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

Conversation

ORabbit
Copy link

@ORabbit ORabbit commented Jul 17, 2023

No description provided.

@ORabbit ORabbit changed the title feat(push): add support for no_wrapper and pubsub_wrapper in push subscriptions feat(push): Add Pub/Sub Subscription support for push payload unwrapping (no wrapper) Jul 28, 2023
@ORabbit ORabbit marked this pull request as ready for review July 28, 2023 21:03
@ORabbit ORabbit requested a review from a team as a code owner July 28, 2023 21:03
@apeabody
Copy link
Contributor

/gcbrun

Copy link
Contributor

@apeabody apeabody left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution @ORabbit! I have included some suggestions below. Cheers!

main.tf Outdated
@@ -195,6 +195,13 @@ resource "google_pubsub_subscription" "push_subscriptions" {
audience = lookup(each.value, "audience", "")
}
}

dynamic "no_wrapper" {
for_each = lookup(each.value, "no_wrapper", "") ? [true] : []
Copy link
Contributor

Choose a reason for hiding this comment

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

Rather than a bool, would it make more sense to use a nested block no_wrapper = {write_metadata: false} with a default of null? That would more closely follow the provider and allow for easy addition of additional keys in the future.

@@ -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

versions.tf Outdated Show resolved Hide resolved
@apeabody
Copy link
Contributor

FYI @ORabbit - The Int CI is returning:

Error: Incorrect condition type

  on ../../main.tf line 200, in resource "google_pubsub_subscription" "push_subscriptions":
 200:       for_each = lookup(each.value, "no_wrapper", "") ? [true] : []
    ├────────────────
    │ each.value is map of string with 5 elements

The condition expression must be of type bool.}
    apply.go:34: 
        	Error Trace:	/builder/home/go/pkg/mod/github.com/gruntwork-io/[email protected]/modules/terraform/apply.go:34
        	            				/builder/home/go/pkg/mod/github.com/!google!cloud!platform/cloud-foundation-toolkit/infra/[email protected]/pkg/tft/terraform.go:393
        	            				/builder/home/go/pkg/mod/github.com/!google!cloud!platform/cloud-foundation-toolkit/infra/[email protected]/pkg/tft/terraform.go:403
        	            				/builder/home/go/pkg/mod/github.com/!google!cloud!platform/cloud-foundation-toolkit/infra/[email protected]/pkg/tft/terraform.go:427
        	            				/builder/home/go/pkg/mod/github.com/!google!cloud!platform/cloud-foundation-toolkit/infra/[email protected]/pkg/utils/stages.go:31
        	            				/builder/home/go/pkg/mod/github.com/!google!cloud!platform/cloud-foundation-toolkit/infra/[email protected]/pkg/tft/terraform.go:427
        	Error:      	Received unexpected error:
        	            	FatalError{Underlying: error while running command: exit status 1; 
        	            	Error: Incorrect condition type
        	            	
        	            	  on ../../main.tf line 200, in resource "google_pubsub_subscription" "push_subscriptions":
        	            	 200:       for_each = lookup(each.value, "no_wrapper", "") ? [true] : []
        	            	    ├────────────────
        	            	    │ each.value is map of string with 5 elements
        	            	
        	            	The condition expression must be of type bool.}
        	Test:       	TestSimple

FYI: Your lookup() has a default of an empty string "", you probably want null.

@github-actions
Copy link

This PR is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days

@github-actions github-actions bot added the Stale label Oct 15, 2023
@github-actions github-actions bot closed this Oct 22, 2023
@nicolasbelanger
Copy link

Any way we can reopen this one? We're blocked by it... (or maybe there's a workaround?)

{
name = "push_payload_unwrapping"
push_endpoint = "https://${var.project_id}.appspot.com/"
no_wrapper = { write_metadata = true }

Choose a reason for hiding this comment

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

I think we need something like

      no_wrapper                 = true
      no_wrapper_write_metadata  = true

@apeabody apeabody reopened this Nov 27, 2023
@apeabody apeabody requested a review from imrannayer as a code owner November 27, 2023 22:50
@apeabody
Copy link
Contributor

/gcbrun

@github-actions github-actions bot removed the Stale label Nov 27, 2023
Copy link

This PR is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days

@github-actions github-actions bot added the Stale label Jan 26, 2024
@github-actions github-actions bot removed the Stale label Jan 29, 2024
Copy link

This PR is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days

@github-actions github-actions bot added the Stale label Mar 30, 2024
@github-actions github-actions bot closed this Apr 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants