Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cloudflare tunnel and refactoring Terraform directories #668

Merged
merged 3 commits into from
Sep 3, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Update: Cleanup
Signed-off-by: Nicolas Lamirault <nicolas.lamirault@gmail.com>
  • Loading branch information
nlamirault committed Sep 3, 2023
commit 0dd1cacf64765d4207027078a4c13503ba2bb18e
19 changes: 10 additions & 9 deletions terraform/k3s/tunnel/tunnel.tf
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ resource "cloudflare_tunnel" "this" {
secret = random_id.tunnel_secret.b64_std
}

resource "cloudflare_record" "this" {
for_each = var.records
# resource "cloudflare_record" "this" {
# for_each = var.records

zone_id = data.cloudflare_zone.this.id
name = format("%s.%s", each.key, local.domain)
value = cloudflare_tunnel.this.cname
type = "CNAME"
proxied = true
}
# zone_id = data.cloudflare_zone.this.id
# name = format("%s.%s", each.key, local.domain)
# value = cloudflare_tunnel.this.cname
# type = "CNAME"
# proxied = true
# }

resource "cloudflare_tunnel_config" "this" {
for_each = var.records
Expand All @@ -41,7 +41,8 @@ resource "cloudflare_tunnel_config" "this" {
tunnel_id = cloudflare_tunnel.this.id
config {
ingress_rule {
hostname = cloudflare_record.this[each.key].hostname
# hostname = cloudflare_record.this[each.key].hostname
hostname = format("%s.%s.%s", each.value.hostname, local.domain, data.cloudflare_zone.this.name)
service = format("http://%s", each.value.service)
}
ingress_rule {
Expand Down