1
1
provider gcore {
2
- user_name = " test"
3
- password = " test"
2
+ # G-Core dashboard => Profile => API tokens => Create token
3
+ permanent_api_token = " "
4
+
5
+ # user_name = "test"
6
+ # password = "test"
7
+
4
8
gcore_platform = " https://api.gcdn.co"
5
9
gcore_cdn_api = " https://api.gcdn.co"
6
10
}
7
11
12
+ resource "gcore_cdn_rule" "cdn_example_com_rule_1" {
13
+ resource_id = gcore_cdn_resource. cdn_example_com . id
14
+ name = " All PNG images"
15
+ rule = " /folder/images/*.png"
16
+ rule_type = 0
17
+
18
+ options {
19
+ edge_cache_settings {
20
+ default = " 4d"
21
+ }
22
+ redirect_http_to_https {
23
+ value = true
24
+ }
25
+ gzip_on {
26
+ value = true
27
+ }
28
+ }
29
+ }
30
+
31
+ resource "gcore_cdn_rule" "cdn_example_com_rule_2" {
32
+ resource_id = gcore_cdn_resource. cdn_example_com . id
33
+ name = " All JS scripts"
34
+ rule = " /folder/images/*.js"
35
+ rule_type = 0
36
+
37
+ options {
38
+ redirect_http_to_https {
39
+ enabled = false
40
+ value = true
41
+ }
42
+ gzip_on {
43
+ enabled = false
44
+ value = true
45
+ }
46
+ }
47
+ }
48
+
8
49
resource "gcore_cdn_origingroup" "origin_group_1" {
9
50
name = " origin_group_1"
10
51
use_next = true
11
52
origin {
12
53
source = " example.com"
13
54
enabled = true
14
55
}
15
- origin {
16
- source = " mirror.example.com"
17
- enabled = true
18
- backup = true
19
- }
20
56
}
21
57
22
58
resource "gcore_cdn_resource" "cdn_example_com" {
@@ -25,17 +61,3 @@ resource "gcore_cdn_resource" "cdn_example_com" {
25
61
origin_protocol = " MATCH"
26
62
secondary_hostnames = [" cdn2.example.com" ]
27
63
}
28
-
29
- resource "gcore_cdn_rule" "cdn_example_com_rule_1" {
30
- resource_id = gcore_cdn_resource. cdn_example_com . id
31
- name = " All images"
32
- rule = " /folder/images/*.png"
33
- rule_type = 0
34
- }
35
-
36
- resource "gcore_cdn_rule" "cdn_example_com_rule_2" {
37
- resource_id = gcore_cdn_resource. cdn_example_com . id
38
- name = " All scripts"
39
- rule = " /folder/images/*.js"
40
- rule_type = 0
41
- }
0 commit comments