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: add bypass_cache_on_request_headers to cdn_policy #385

Conversation

hhollenstain
Copy link
Contributor

Add bypass_cache_on_request_headers to cdn_policy. This was added back on compute_backend on the provider on 4.64.0

@hhollenstain hhollenstain requested review from imrannayer and a team as code owners November 16, 2023 00:18
Copy link

google-cla bot commented Nov 16, 2023

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

main.tf Outdated Show resolved Hide resolved
@imrannayer
Copy link
Collaborator

@hhollenstain thanks for the PR. Can you plz check the logic?

@hhollenstain hhollenstain force-pushed the feat_bypass_cache_on_request_headers branch 2 times, most recently from 60033cc to 24d7b18 Compare November 16, 2023 03:48
@imrannayer
Copy link
Collaborator

/gcbrun

@imrannayer
Copy link
Collaborator

@hhollenstain test is failing:

Code:

TestAll/examples/cdn-policy 2023-11-16T14:54:03Z command.go:185:   # module.gce-lb-http.google_compute_backend_service.default["default"] will be created
TestAll/examples/cdn-policy 2023-11-16T14:54:03Z command.go:185:   + resource "google_compute_backend_service" "default" {
TestAll/examples/cdn-policy 2023-11-16T14:54:03Z command.go:185:       + connection_draining_timeout_sec = 300
TestAll/examples/cdn-policy 2023-11-16T14:54:03Z command.go:185:       + creation_timestamp              = (known after apply)
TestAll/examples/cdn-policy 2023-11-16T14:54:03Z command.go:185:       + enable_cdn                      = true
TestAll/examples/cdn-policy 2023-11-16T14:54:03Z command.go:185:       + fingerprint                     = (known after apply)
TestAll/examples/cdn-policy 2023-11-16T14:54:03Z command.go:185:       + generated_id                    = (known after apply)
TestAll/examples/cdn-policy 2023-11-16T14:54:03Z command.go:185:       + health_checks                   = (known after apply)
TestAll/examples/cdn-policy 2023-11-16T14:54:03Z command.go:185:       + id                              = (known after apply)
TestAll/examples/cdn-policy 2023-11-16T14:54:03Z command.go:185:       + load_balancing_scheme           = "EXTERNAL"
TestAll/examples/cdn-policy 2023-11-16T14:54:03Z command.go:185:       + name                            = "mig-http-lb-backend-default"
TestAll/examples/cdn-policy 2023-11-16T14:54:03Z command.go:185:       + port_name                       = "http"
TestAll/examples/cdn-policy 2023-11-16T14:54:03Z command.go:185:       + project                         = "ci-int-lb-http-368b"
TestAll/examples/cdn-policy 2023-11-16T14:54:03Z command.go:185:       + protocol                        = "HTTP"
TestAll/examples/cdn-policy 2023-11-16T14:54:03Z command.go:185:       + self_link                       = (known after apply)
TestAll/examples/cdn-policy 2023-11-16T14:54:03Z command.go:185:       + session_affinity                = (known after apply)
TestAll/examples/cdn-policy 2023-11-16T14:54:03Z command.go:185:       + timeout_sec                     = 10
TestAll/examples/cdn-policy 2023-11-16T14:54:03Z command.go:185: 
TestAll/examples/cdn-policy 2023-11-16T14:54:03Z command.go:185:       + backend {
TestAll/examples/cdn-policy 2023-11-16T14:54:03Z command.go:185:           + balancing_mode               = "UTILIZATION"
TestAll/examples/cdn-policy 2023-11-16T14:54:03Z command.go:185:           + capacity_scaler              = 1
TestAll/examples/cdn-policy 2023-11-16T14:54:03Z command.go:185:           + group                        = (known after apply)
TestAll/examples/cdn-policy 2023-11-16T14:54:03Z command.go:185:           + max_connections              = (known after apply)
TestAll/examples/cdn-policy 2023-11-16T14:54:03Z command.go:185:           + max_connections_per_endpoint = (known after apply)
TestAll/examples/cdn-policy 2023-11-16T14:54:03Z command.go:185:           + max_connections_per_instance = (known after apply)
TestAll/examples/cdn-policy 2023-11-16T14:54:03Z command.go:185:           + max_rate                     = (known after apply)
TestAll/examples/cdn-policy 2023-11-16T14:54:03Z command.go:185:           + max_rate_per_endpoint        = (known after apply)
TestAll/examples/cdn-policy 2023-11-16T14:54:03Z command.go:185:           + max_rate_per_instance        = (known after apply)
TestAll/examples/cdn-policy 2023-11-16T14:54:03Z command.go:185:           + max_utilization              = (known after apply)
TestAll/examples/cdn-policy 2023-11-16T14:54:03Z command.go:185:         }
TestAll/examples/cdn-policy 2023-11-16T14:54:03Z command.go:185: 
TestAll/examples/cdn-policy 2023-11-16T14:54:03Z command.go:185:       + cdn_policy {
TestAll/examples/cdn-policy 2023-11-16T14:54:03Z command.go:185:           + cache_mode                   = "CACHE_ALL_STATIC"
TestAll/examples/cdn-policy 2023-11-16T14:54:03Z command.go:185:           + client_ttl                   = 7200
TestAll/examples/cdn-policy 2023-11-16T14:54:03Z command.go:185:           + default_ttl                  = 3600
TestAll/examples/cdn-policy 2023-11-16T14:54:03Z command.go:185:           + max_ttl                      = 10800
TestAll/examples/cdn-policy 2023-11-16T14:54:03Z command.go:185:           + negative_caching             = (known after apply)
TestAll/examples/cdn-policy 2023-11-16T14:54:03Z command.go:185:           + serve_while_stale            = (known after apply)
TestAll/examples/cdn-policy 2023-11-16T14:54:03Z command.go:185:           + signed_url_cache_max_age_sec = 3600
TestAll/examples/cdn-policy 2023-11-16T14:54:03Z command.go:185: 
TestAll/examples/cdn-policy 2023-11-16T14:54:03Z command.go:185:           + bypass_cache_on_request_headers {
TestAll/examples/cdn-policy 2023-11-16T14:54:03Z command.go:185:               + header_name = "default"
TestAll/examples/cdn-policy 2023-11-16T14:54:03Z command.go:185:             }
TestAll/examples/cdn-policy 2023-11-16T14:54:03Z command.go:185:           + bypass_cache_on_request_headers {
TestAll/examples/cdn-policy 2023-11-16T14:54:03Z command.go:185:               + header_name = "default"
TestAll/examples/cdn-policy 2023-11-16T14:54:03Z command.go:185:             }
TestAll/examples/cdn-policy 2023-11-16T14:54:03Z command.go:185: 
TestAll/examples/cdn-policy 2023-11-16T14:54:03Z command.go:185:           + cache_key_policy {
TestAll/examples/cdn-policy 2023-11-16T14:54:03Z command.go:185:               + include_host          = true
TestAll/examples/cdn-policy 2023-11-16T14:54:03Z command.go:185:               + include_named_cookies = [
TestAll/examples/cdn-policy 2023-11-16T14:54:03Z command.go:185:                   + "__next_preview_data",
TestAll/examples/cdn-policy 2023-11-16T14:54:03Z command.go:185:                   + "__prerender_bypass",
TestAll/examples/cdn-policy 2023-11-16T14:54:03Z command.go:185:                 ]
TestAll/examples/cdn-policy 2023-11-16T14:54:03Z command.go:185:               + include_protocol      = true
TestAll/examples/cdn-policy 2023-11-16T14:54:03Z command.go:185:               + include_query_string  = true
TestAll/examples/cdn-policy 2023-11-16T14:54:03Z command.go:185:             }
TestAll/examples/cdn-policy 2023-11-16T14:54:03Z command.go:185:         }
TestAll/examples/cdn-policy 2023-11-16T14:54:03Z command.go:185:     }
TestAll/examples/cdn-policy 2023-11-16T14:54:03Z command.go:185: 

Error:

TestAll/examples/cdn-policy 2023-11-16T14:55:34Z command.go:185: 
TestAll/examples/cdn-policy 2023-11-16T14:55:34Z command.go:185: Error: Error creating BackendService: googleapi: Error 400: Invalid value for field 'resource.cdnPolicy.bypassCacheOnRequestHeaders[1].headerName': 'default'. Cannot have multiple headers with the same name: default, invalid
TestAll/examples/cdn-policy 2023-11-16T14:55:34Z command.go:185: 
TestAll/examples/cdn-policy 2023-11-16T14:55:34Z command.go:185:   with module.gce-lb-http.google_compute_backend_service.default["default"],
TestAll/examples/cdn-policy 2023-11-16T14:55:34Z command.go:185:   on ../../main.tf line 182, in resource "google_compute_backend_service" "default":
TestAll/examples/cdn-policy 2023-11-16T14:55:34Z command.go:185:  182: resource "google_compute_backend_service" "default" {
TestAll/examples/cdn-policy 2023-11-16T14:55:34Z command.go:185: 
TestAll/examples/cdn-policy 2023-11-16T14:55:34Z retry.go:99: Returning due to fatal error: FatalError{Underlying: error while running command: exit status 1; 
Error: Error creating BackendService: googleapi: Error 400: Invalid value for field 'resource.cdnPolicy.bypassCacheOnRequestHeaders[1].headerName': 'default'. Cannot have multiple headers with the same name: default, invalid

  with module.gce-lb-http.google_compute_backend_service.default["default"],
  on ../../main.tf line 182, in resource "google_compute_backend_service" "default":
 182: resource "google_compute_backend_service" "default" {
}
    apply.go:34: 
        	Error Trace:	/builder/home/go/pkg/mod/github.com/gruntwork-io/terratest@v0.43.13/modules/terraform/apply.go:34
        	            				/builder/home/go/pkg/mod/github.com/!google!cloud!platform/cloud-foundation-toolkit/infra/blueprint-test@v0.9.1/pkg/tft/terraform.go:437
        	            				/builder/home/go/pkg/mod/github.com/!google!cloud!platform/cloud-foundation-toolkit/infra/blueprint-test@v0.9.1/pkg/tft/terraform.go:447
        	            				/builder/home/go/pkg/mod/github.com/!google!cloud!platform/cloud-foundation-toolkit/infra/blueprint-test@v0.9.1/pkg/tft/terraform.go:471
        	            				/builder/home/go/pkg/mod/github.com/!google!cloud!platform/cloud-foundation-toolkit/infra/blueprint-test@v0.9.1/pkg/utils/stages.go:31
        	            				/builder/home/go/pkg/mod/github.com/!google!cloud!platform/cloud-foundation-toolkit/infra/blueprint-test@v0.9.1/pkg/tft/terraform.go:471
        	Error:      	Received unexpected error:
        	            	FatalError{Underlying: error while running command: exit status 1; 
        	            	Error: Error creating BackendService: googleapi: Error 400: Invalid value for field 'resource.cdnPolicy.bypassCacheOnRequestHeaders[1].headerName': 'default'. Cannot have multiple headers with the same name: default, invalid
        	            	
        	            	  with module.gce-lb-http.google_compute_backend_service.default["default"],
        	            	  on ../../main.tf line 182, in resource "google_compute_backend_service" "default":
        	            	 182: resource "google_compute_backend_service" "default" {
        	            	}
        	Test:       	TestAll/examples/cdn-policy
2023/11/16 14:55:34 RUN_STAGE env var set to apply
2023/11/16 14:55:34 Skipping stage teardown
--- FAIL: TestAll (96.98s)

@hhollenstain hhollenstain force-pushed the feat_bypass_cache_on_request_headers branch from 24d7b18 to fcbbfe5 Compare November 16, 2023 20:20
@imrannayer
Copy link
Collaborator

/gcbrun

@hhollenstain
Copy link
Contributor Author

@imrannayer Thanks for getting me the test results

I hooked this up to a env to make sure this is rendering as expected and needed to act on proper value. Just pushed it up and seems like you are already on it. Thanks for all the help.

@imrannayer imrannayer merged commit e91961b into terraform-google-modules:master Nov 17, 2023
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants