-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcloudflare.tf
56 lines (51 loc) · 1.27 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
#Page site
resource "cloudflare_pages_project" "website" {
account_id = var.account_id
name = var.site_name
production_branch = "master"
build_config {
build_command = "hugo"
destination_dir = "public"
root_dir = ""
}
source {
type = "github"
config {
owner = "billqmao"
repo_name = var.repo_name
production_branch = "master"
pr_comments_enabled = true
deployments_enabled = true
production_deployment_enabled = true
preview_branch_excludes = ["master"]
}
}
deployment_configs {
preview {
environment_variables = {
HUGO_VERSION = "0.125.6"
}
}
production {
environment_variables = {
HUGO_VERSION = "0.125.6"
}
}
}
}
#Custom domain
resource "cloudflare_pages_domain" "site_domain" {
account_id = var.account_id
project_name = var.site_name
domain = var.domain
count = var.domain == "" ? 0 : 1
}
resource "cloudflare_record" "cname_pages" {
zone_id = var.cloudflare_zone_id
name = "@"
value = "${var.site_name}.pages.dev"
type = "CNAME"
ttl = 1
proxied = true
count = var.domain == "" ? 0 : 1
}