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

Add fields to configure new Media CDN features in networkservices/EdgeCacheService #21064

Comments

@nahurfonseca
Copy link

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 a user, that user is claiming responsibility for the issue.
  • Customers working with a Google Technical Account Manager or Customer Engineer can ask them to reach out internally to expedite investigation and resolution of this issue.

Description

Dynamic Compression is already in public preview, and it can be configured via the Restful API and gcloud CLI. This PR adds the new field compression_mode to configure dynamic compression for Media CDN via Terraform. See http://cloud/media-cdn/docs/dynamic-compression for more details.

By default, Media CDN proxies only GET, HEAD, and OPTIONS methods to your origin and filters out the methods that can modify your origin.
This PR adds the field allowed_methods to Terraform, so other methods such as PUT, POST, DELETE, and PATCH can be supported. See https://cloud.google.com/media-cdn/docs/routing#method-filtering for more details.

New or Affected Resource(s)

  • google_network_services_edge_cache_service.*

Potential Terraform Configuration

resource "google_storage_bucket" "dest" {
  name          = "%s"
  location      = "US"
  force_destroy = true
}
resource "google_network_services_edge_cache_origin" "instance" {
  name           = "%s"
  origin_address = google_storage_bucket.dest.url
  description    = "The default bucket for media edge test"
  max_attempts   = 2
  timeout {
    connect_timeout = "10s"
  }
}
resource "google_network_services_edge_cache_service" "served" {
  name        = "%s"
  description = "some description"
  routing {
    host_rule {
      description  = "host rule description"
      hosts        = ["sslcert.tf-test.club"]
      path_matcher = "routes"
    }
    path_matcher {
      name = "routes"
      route_rule {
        description = "a route rule to match against"
        priority    = 1
        match_rule {
          prefix_match = "/"
        }
        origin = google_network_services_edge_cache_origin.instance.name
        route_action {
          cdn_policy {
            cache_mode  = "CACHE_ALL_STATIC"
            default_ttl = "3600s"
          }
          compression_mode = "AUTOMATIC"
        }
        route_methods {
          allowed_methods = ["GET", "HEAD", "OPTIONS", "PUT", "POST", "DELETE", "PATCH"]
        }
        header_action {
          response_header_to_add {
            header_name  = "x-cache-status"
            header_value = "{cdn_cache_status}"
          }
        }
      }
    }
  }
}

References

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment