feat: add terraform
This commit is contained in:
parent
1614412d2a
commit
43708777b4
10 changed files with 379 additions and 1 deletions
89
dns.tf
Normal file
89
dns.tf
Normal file
|
|
@ -0,0 +1,89 @@
|
|||
# data "cloudflare_zone" "cthulhunetes" {
|
||||
# name = "cthulhunetes.net"
|
||||
# }
|
||||
|
||||
# resource "cloudflare_zone" "cthulhunetes" {
|
||||
# account_id = "f24333bb3c47d6db753e57e2a0c90082"
|
||||
# zone = "cthulhunetes.net"
|
||||
# }
|
||||
|
||||
# resource "cloudflare_zone_dnssec" "cthulhunetes" {
|
||||
# zone_id = cloudflare_zone.cthulhunetes.id
|
||||
# }
|
||||
|
||||
# resource "cloudflare_zone_settings_override" "cthulhunetes" {
|
||||
# zone_id = cloudflare_zone.cthulhunetes.id
|
||||
# settings {
|
||||
# always_use_https = "on"
|
||||
# automatic_https_rewrites = "on"
|
||||
# ssl = "full"
|
||||
# }
|
||||
# }
|
||||
|
||||
resource "cloudflare_record" "cthulhu_control_plane" {
|
||||
count = length(hcloud_server.cthulhu_control_plane)
|
||||
|
||||
zone_id = data.cloudflare_zone.vxm_cz.id
|
||||
name = "control-plane-${count.index}.cthulhu.k8s"
|
||||
value = hcloud_server.cthulhu_control_plane[count.index].ipv4_address
|
||||
type = "A"
|
||||
proxied = false
|
||||
}
|
||||
|
||||
resource "cloudflare_record" "cthulhu_control_plane_ipv6" {
|
||||
count = length(hcloud_server.cthulhu_control_plane)
|
||||
|
||||
zone_id = data.cloudflare_zone.vxm_cz.id
|
||||
name = "control-plane-${count.index}.cthulhu.k8s"
|
||||
value = hcloud_server.cthulhu_control_plane[count.index].ipv6_address
|
||||
type = "AAAA"
|
||||
proxied = false
|
||||
}
|
||||
|
||||
resource "cloudflare_record" "cthulhu_kubeapi_singlenode" {
|
||||
count = length(hcloud_server.cthulhu_control_plane) == 1 ? 1 : 0
|
||||
|
||||
zone_id = data.cloudflare_zone.vxm_cz.id
|
||||
name = "api.cthulhu.k8s"
|
||||
value = hcloud_server.cthulhu_control_plane[0].ipv4_address
|
||||
type = "A"
|
||||
proxied = false
|
||||
}
|
||||
|
||||
resource "cloudflare_record" "cthulhu_kubeapi_singlenode_ipv6" {
|
||||
count = length(hcloud_server.cthulhu_control_plane) == 1 ? 1 : 0
|
||||
|
||||
zone_id = data.cloudflare_zone.vxm_cz.id
|
||||
name = "api.cthulhu.k8s"
|
||||
value = hcloud_server.cthulhu_control_plane[0].ipv6_address
|
||||
type = "AAAA"
|
||||
proxied = false
|
||||
}
|
||||
|
||||
resource "cloudflare_record" "cthulhu_workers" {
|
||||
count = length(hcloud_server.cthulhu_workers)
|
||||
|
||||
zone_id = data.cloudflare_zone.vxm_cz.id
|
||||
name = "worker-${random_string.workers_suffix.result}-${count.index}.cthulhu.k8s"
|
||||
value = hcloud_server.cthulhu_workers[count.index].ipv4_address
|
||||
type = "A"
|
||||
proxied = false
|
||||
}
|
||||
|
||||
resource "cloudflare_record" "cthulhu_workers_ipv6" {
|
||||
count = length(hcloud_server.cthulhu_workers)
|
||||
|
||||
zone_id = data.cloudflare_zone.vxm_cz.id
|
||||
name = "worker-${random_string.workers_suffix.result}-${count.index}.cthulhu.k8s"
|
||||
value = hcloud_server.cthulhu_workers[count.index].ipv6_address
|
||||
type = "AAAA"
|
||||
proxied = false
|
||||
}
|
||||
|
||||
resource "cloudflare_record" "cthulhu_wildcard" {
|
||||
zone_id = data.cloudflare_zone.vxm_cz.id
|
||||
name = "*.cthulhu.k8s"
|
||||
value = cloudflare_record.ingress_cthulhu_k8s_vxm_cz.hostname
|
||||
type = "CNAME"
|
||||
proxied = false
|
||||
}
|
||||
Reference in a new issue