Skip to content

Commit 6b19f52

Browse files
committed
Prepared mediacdn_edge_cache_service for update in C.G.C. documentation
1 parent 864a2dd commit 6b19f52

File tree

1 file changed

+31
-2
lines changed

1 file changed

+31
-2
lines changed

media_cdn/quickstart/main.tf

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ resource "google_network_services_edge_cache_service" "default" {
4949
path_matcher {
5050
name = "routes"
5151
route_rule {
52-
description = "a route rule to match against"
53-
priority = 1
52+
description = "a simple route rule, priority=10 (low)"
53+
priority = 10
5454
match_rule {
5555
prefix_match = "/"
5656
}
@@ -68,6 +68,35 @@ resource "google_network_services_edge_cache_service" "default" {
6868
}
6969
}
7070
}
71+
// for other advanced features examples see:
72+
// https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/network_services_edge_cache_service
73+
route_rule {
74+
description = "an advanced route rule, priority=1 (high)"
75+
priority = 1
76+
match_rule {
77+
prefix_match = "/advanced"
78+
}
79+
origin = google_network_services_edge_cache_origin.default.name
80+
route_action {
81+
cdn_policy {
82+
cache_mode = "CACHE_ALL_STATIC"
83+
default_ttl = "3600s"
84+
}
85+
url_rewrite {
86+
path_prefix_rewrite = "/"
87+
}
88+
compression_mode = "AUTOMATIC"
89+
}
90+
route_methods {
91+
allowed_methods = ["GET", "HEAD", "PUT", "POST", "DELETE"]
92+
}
93+
header_action {
94+
response_header_to_add {
95+
header_name = "x-cache-status"
96+
header_value = "{cdn_cache_status}"
97+
}
98+
}
99+
}
71100
}
72101
}
73102
}

0 commit comments

Comments
 (0)