Skip to content

Fix zero value omission for BackendService CDN Policy TTLs#18108

Draft
burczyk wants to merge 2 commits into
GoogleCloudPlatform:mainfrom
burczyk:fix-backend-service-zero-ttl-option1
Draft

Fix zero value omission for BackendService CDN Policy TTLs#18108
burczyk wants to merge 2 commits into
GoogleCloudPlatform:mainfrom
burczyk:fix-backend-service-zero-ttl-option1

Conversation

@burczyk

@burczyk burczyk commented Jun 26, 2026

Copy link
Copy Markdown
Member

Summary of changes:

  1. Custom Expander Template: Created backend_service_cdn_policy_ttl.go.tmpl using d.GetOkExists to distinguish between explicit 0 and omission. It returns a pointer *int which allows Terraform to distinguish 0 from nil (omitted).
  2. YAML Updates: Registered this custom expander in BackendService.yaml and RegionBackendService.yaml for defaultTtl, maxTtl, and clientTtl.
  3. Tests Added: Added backend_service_cache_zero_ttl and backend_service_cache_omitted_ttl samples to verify the fix and prevent regressions.
  4. Verification: All related tests passed, including the one that was failing with Option 2 (TestAccComputeBackendService_backendServiceCacheIncludeHttpHeadersExample), confirming that omitted TTLs are no longer implicitly sent as 0.

Linked Issues:

Fixes https://issuetracker.google.com/issues/498433517

Release Note Template for Downstream PRs (will be copied)

See Write release notes for guidance.

compute: fixed omission of explicit `0` values for `default_ttl`, `max_ttl`, and `client_ttl` in `cdn_policy` for `google_compute_backend_service` and `google_compute_region_backend_service`

@modular-magician modular-magician added the awaiting-approval Pull requests that need reviewer's approval to run presubmit tests label Jun 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting-approval Pull requests that need reviewer's approval to run presubmit tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants