Skip to content

Add fields to configure new Media CDN feature (flexible shielding) in networkservices/EdgeCacheOrigin #22376

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

Open
rthorn opened this issue Apr 16, 2025 · 0 comments · May be fixed by GoogleCloudPlatform/magic-modules#13696

Comments

@rthorn
Copy link

rthorn commented Apr 16, 2025

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

Flexible shielding for Media CDN is about to go into public preview, and it will be configurable via the Restful API and gcloud CLI. This PR adds the new field flex_shielding to configure flexible shielding for Media CDN via Terraform.

By default, Media CDN uses global origin shielding for all customer origins; flexible shielding allows customers to configure a specific region to use for all traffic to the origin globally.

New or Affected Resource(s)

  • google_network_services_edge_cache_origin.*

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"
  }
  flex_shielding {
    flex_shielding_regions = ["AFRICA_SOUTH1"]
  }
}
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
Projects
None yet
1 participant