From c7d6938517473ed84971de053722a81fc131c14d Mon Sep 17 00:00:00 2001 From: Kat Inskip Date: Thu, 18 Jul 2024 16:11:00 -0700 Subject: [PATCH] feat: add cloudflare pages for wiki --- tf/cloudflare_pages.tf | 43 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 tf/cloudflare_pages.tf diff --git a/tf/cloudflare_pages.tf b/tf/cloudflare_pages.tf new file mode 100644 index 00000000..95e0fa4a --- /dev/null +++ b/tf/cloudflare_pages.tf @@ -0,0 +1,43 @@ +resource "cloudflare_pages_project" "wiki" { + account_id = var.cloudflare_account_id + name = "wiki" + production_branch = "main" + + source { + type = "github" + config { + owner = "gensokyo-zone" + repo_name = "wiki" + production_branch = "main" + deployments_enabled = true + pr_comments_enabled = false + production_deployment_enabled = true + } + } + build_config { + build_command = "npx quartz build" + destination_dir = "public" + root_dir = "/" + } + lifecycle { + ignore_changes = [ + deployment_configs, + source + ] + } +} + +resource "cloudflare_pages_domain" "wiki" { + account_id = var.cloudflare_account_id + project_name = "wiki" + domain = "wiki.gensokyo.zone" +} + +resource "cloudflare_record" "wiki" { + zone_id = cloudflare_zone.gensokyo-zone_zone.id + name = "wiki" + proxied = false + ttl = 3600 + type = "CNAME" + value = cloudflare_pages_project.wiki.subdomain +}