From cb4a8bf8f4ffa263838d82b24b38845a74a6db60 Mon Sep 17 00:00:00 2001 From: clarkzjw Date: Mon, 12 Dec 2022 11:08:00 -0800 Subject: infra: add argo tunnel ingress rule for ttrss, refactor needed --- jinwei.me/infra/cloudflare.tf | 17 +++++++++++++++++ jinwei.me/infra/variables.tf | 5 +++++ 2 files changed, 22 insertions(+) diff --git a/jinwei.me/infra/cloudflare.tf b/jinwei.me/infra/cloudflare.tf index 5d81462..ce1add3 100644 --- a/jinwei.me/infra/cloudflare.tf +++ b/jinwei.me/infra/cloudflare.tf @@ -35,6 +35,18 @@ resource "cloudflare_record" "tunnel_dns" { proxied = true } +# TODO +# since cloudflare terraform provider does not provide an argo tunnel data source +# refactor this as a separate module? +# https://registry.terraform.io/providers/cloudflare/cloudflare/3.29.0 +resource "cloudflare_record" "rss_dns" { + zone_id = data.cloudflare_zones.domain.zones[0].id + name = var.feed_domain + value = "${cloudflare_argo_tunnel.tunnel.id}.cfargotunnel.com" + type = "CNAME" + proxied = true +} + resource "cloudflare_tunnel_config" "tunnel_route" { account_id = var.cloudflare_account_id tunnel_id = cloudflare_argo_tunnel.tunnel.id @@ -45,6 +57,11 @@ resource "cloudflare_tunnel_config" "tunnel_route" { path = "/" service = "http://wordpress:80" } + ingress_rule { + hostname = "feed.jinwei.me" + path = "/" + service = "http://ttrss:80" + } ingress_rule { service = "http_status:404" } diff --git a/jinwei.me/infra/variables.tf b/jinwei.me/infra/variables.tf index 87283cc..a3cf8bb 100644 --- a/jinwei.me/infra/variables.tf +++ b/jinwei.me/infra/variables.tf @@ -55,6 +55,11 @@ variable "site_domain" { default = "jinwei.me" } +variable "feed_domain" { + type = string + default = "feed.jinwei.me" +} + variable "s3_cdn_name" { type = string default = "static" -- cgit v1.2.3