1+ resource "tencentcloud_teo_zone" "example" {
2+ zone_name = " example.com"
3+ plan_type = " <your-plan-type>"
4+
5+ tags = {
6+ " createdBy" = " terraform"
7+ }
8+ }
9+
10+ resource "tencentcloud_teo_zone_setting" "example" {
11+ zone_id = tencentcloud_teo_zone. example . id
12+
13+ # Cache Configuration
14+ cache {
15+ follow_origin {
16+ switch = " on"
17+ }
18+ }
19+ # CacheKey Configuration
20+ cache_key {
21+ full_url_cache = " off"
22+ ignore_case = " on"
23+ query_string {
24+ switch = " on"
25+ action = " includeCustom" # use specific parameters from URL
26+ value = [" param0" , " param1" ]
27+ }
28+ }
29+ # HTTPS Configuration
30+ https {
31+ http2 = " on"
32+ ocsp_stapling = " on"
33+ tls_version = [" TLSv1.2" , " TLSv1.3" ]
34+ hsts {
35+ include_sub_domains = " off"
36+ max_age = 0
37+ preload = " off"
38+ switch = " off"
39+ }
40+ }
41+ # Smart Compression Configuration
42+ compression {
43+ switch = " on"
44+ algorithms = [" brotli" , " gzip" ]
45+ }
46+ # Carry client IP to origin site
47+ client_ip_header {
48+ switch = " on"
49+ header_name = " EO-Client-IPCountry"
50+ }
51+ }
52+
53+ resource "tencentcloud_teo_dns_record" "rule_record" {
54+ zone_id = tencentcloud_teo_zone. example . id
55+ type = " A"
56+ name = " rule.example.com"
57+ content = " 1.1.1.1"
58+ mode = " proxied"
59+ ttl = 300
60+ }
61+
62+ # subdomain specific configuration
63+ resource "tencentcloud_teo_rule_engine" "rule_example" {
64+ zone_id = tencentcloud_teo_zone. example . id
65+ rule_name = " example_rule"
66+ status = " enable"
67+
68+ rules {
69+ # when request host is rule.example.com and file suffix is mp3 or mp4
70+ or {
71+ and {
72+ target = " host"
73+ operator = " equal"
74+ values = [tencentcloud_teo_dns_record . rule_record . name ]
75+ }
76+ and {
77+ target = " extension"
78+ operator = " equal"
79+ values = [" mp4" , " mp3" ]
80+ }
81+ }
82+
83+ actions {
84+ normal_action {
85+ action = " CacheKey"
86+ # CacheKey is ignore case
87+ parameters {
88+ name = " Type"
89+ values = [" IgnoreCase" ]
90+ }
91+ parameters {
92+ name = " Switch"
93+ values = [" off" ]
94+ }
95+ # CacheKey should use User-Agent Header
96+ parameters {
97+ name = " Type"
98+ values = [" Header" ]
99+ }
100+ parameters {
101+ name = " Switch"
102+ values = [" on" ]
103+ }
104+ parameters {
105+ name = " Value"
106+ values = [" User-Agent" ]
107+ }
108+ }
109+ }
110+
111+ # Add a HTTP header to response
112+ actions {
113+ rewrite_action {
114+ action = " ResponseHeader"
115+ parameters {
116+ action = " add"
117+ name = " Added-Header"
118+ values = [" Added-Value" ]
119+ }
120+ }
121+ }
122+ }
123+ }
0 commit comments