Skip to content

Commit

Permalink
cloudflare_dns_record
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasCardin committed Nov 21, 2024
1 parent 75fdac6 commit 079b080
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 10 deletions.
2 changes: 1 addition & 1 deletion terraform/main.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module "cname-records" {
source = "./modules/records"
source = "./modules/dns_records"
cloudflare_zone_id = var.cloudflare_zone_id

names = ["argocd", "trilium", "ollama", "ceph", "grafana", "oauth2"]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
resource "cloudflare_record" "record" {
resource "cloudflare_dns_record" "record" {
for_each = var.names

zone_id = var.cloudflare_zone_id
value = var.dns
name = each.value
name = each.key
type = var.type
ttl = 1
proxied = true
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
variable "cloudflare_zone_id" {
description = "The zone ID for Cloudflare"
type = string
type = string
}

variable "dns" {
description = "value for DNS record"
type = string
default = "ninebasetwo.net"
type = string
default = "ninebasetwo.net"
}

variable "names" {
description = "names of record"
type = list(string)
type = list(string)
}

variable "type" {
description = "type of record"
type = string
default = "CNAME"
type = string
default = "CNAME"
}
2 changes: 1 addition & 1 deletion terraform/modules/zero_trust_application/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ resource "cloudflare_zero_trust_access_application" "app" {
zone_id = "0da42c8d2132a9ddaf714f9e7c920711"
name = "staging application"
domain = "staging.example.com"
type = "self_hosted"
type = var.type
session_duration = "24h"
auto_redirect_to_identity = false
policies = [
Expand Down
8 changes: 8 additions & 0 deletions terraform/modules/zero_trust_application/providers.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
terraform {
required_providers {
cloudflare = {
source = "cloudflare/cloudflare"
version = "5.0.0-alpha1"
}
}
}
5 changes: 5 additions & 0 deletions terraform/modules/zero_trust_application/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
variable "type" {
description = "type of the zero trust access application"
type = string
default = "self_hosted"
}

0 comments on commit 079b080

Please sign in to comment.