-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcloudflare.tf
99 lines (86 loc) · 1.9 KB
/
cloudflare.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
provider "cloudflare" {
}
variable "cloudflare_account_id" {
type = string
}
resource "cloudflare_zone" "njulug-org" {
account_id = var.cloudflare_account_id
zone = "njulug.org"
}
# ttl = 1 for automatic
# njulug.org
resource "cloudflare_record" "njulug" {
name = "njulug.org"
proxied = true
ttl = 1
type = "CNAME"
value = "nju-lug.github.io"
zone_id = cloudflare_zone.njulug-org.id
}
# 302 redirect njulug.org to https://github.com/nju-lug
resource "cloudflare_page_rule" "njulug_to_github" {
priority = 1
status = "active"
target = "njulug.org/"
zone_id = cloudflare_zone.njulug-org.id
actions {
forwarding_url {
status_code = 302
url = "https://github.com/nju-lug"
}
}
}
# blogroll
resource "cloudflare_record" "blogroll" {
name = "blogroll"
proxied = true
ttl = 1
type = "CNAME"
value = "blogroll.0yinfeng1686.workers.dev"
zone_id = cloudflare_zone.njulug-org.id
}
# email routing
resource "cloudflare_email_routing_settings" "njulug" {
zone_id = cloudflare_zone.njulug-org.id
enabled = true
}
resource "cloudflare_email_routing_rule" "postmaster" {
zone_id = cloudflare_zone.njulug-org.id
name = "postmaster"
enabled = true
matcher {
type = "literal"
field = "to"
value = "[email protected]"
}
action {
type = "forward"
value = ["[email protected]"]
}
}
resource "cloudflare_email_routing_rule" "admin" {
zone_id = cloudflare_zone.njulug-org.id
name = "admin"
enabled = true
matcher {
type = "literal"
field = "to"
value = "[email protected]"
}
action {
type = "forward"
value = ["[email protected]"]
}
}
resource "cloudflare_email_routing_catch_all" "njulug" {
zone_id = cloudflare_zone.njulug-org.id
name = "catch all"
enabled = true
matcher {
type = "all"
}
action {
type = "drop"
value = []
}
}