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

backend_service CDN policy not applying negative_caching and serve_while_stale #9183

Closed
Assignees
Labels

Comments

@jeremypick-sky
Copy link

jeremypick-sky commented May 19, 2021

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request.
  • Please do not leave +1 or me too comments, they generate extra noise for issue followers and do not help prioritize the request.
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment.
  • If an issue is assigned to the modular-magician user, it is either in the process of being autogenerated, or is planned to be autogenerated soon. If an issue is assigned to a user, that user is claiming responsibility for the issue. If an issue is assigned to hashibot, a community member has claimed the issue already.

Terraform Version

Affected Resource(s)

  • google_compute_backend_service

Terraform Configuration Files

resource "google_compute_backend_service" "backend-service" {
  provider       = google-beta
  name          = "${var.backend_name}-backend-service"
  enable_cdn    = var.use_cloud_cdn
  cdn_policy {
    cache_mode = "USE_ORIGIN_HEADERS"
    negative_caching = false
    serve_while_stale = 0
    cache_key_policy {
      include_host           = true
      include_protocol       = true
      include_query_string   = true
      query_string_blacklist = []
      query_string_whitelist = []
    }
  }
  health_checks = [google_compute_http_health_check.backend-healthcheck-stats.self_link]
  security_policy = google_compute_security_policy.sds-cloud-armor.self_link
  backend {
    group = google_compute_instance_group.backend-instance-group.self_link
  }
  log_config {
    enable = "true"
    sample_rate = "1.0"
  }
}

Debug Output

https://gist.github.com/jeremypick-sky/d8df738810f7f4e1712108abd51dd0ba

Panic Output

Expected Behavior

Cloud CDN should be provisioned with "Enable Negative Caching" turned off and "Serve While Stale" disabled

Actual Behavior

Cloud CDN provisioned with "Enable Negative Caching" turned on and "Serve While Stale" set to 1 day

Steps to Reproduce

  1. terraform apply
  2. terraform plan

Output will show

      ~ cdn_policy {
            cache_mode                   = "USE_ORIGIN_HEADERS"
            client_ttl                   = 0
            default_ttl                  = 0
            max_ttl                      = 0
          ~ negative_caching             = true -> false
          ~ serve_while_stale            = 86400 -> 0
            signed_url_cache_max_age_sec = 3600

            cache_key_policy {
                include_host           = true
                include_protocol       = true
                include_query_string   = true
                query_string_blacklist = []
                query_string_whitelist = []
            }
        }

Important Factoids

References

  • #0000
@github-actions
Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 21, 2021
@github-actions github-actions bot added forward/review In review; remove label to forward service/compute-l7-load-balancer labels Jan 14, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.