Merge infra and k3 into one directory again
Since I don't have multiple terraform steps anymore it simply doesn't make sense to me anymore to split all tasks into separate folders. Instead I try to be as clear as possible in the README to make it easy to follow the structure in the future without too much headache.
This commit is contained in:
25
modules/hetzner/dns/main.tf
Normal file
25
modules/hetzner/dns/main.tf
Normal file
@@ -0,0 +1,25 @@
|
||||
resource "hetznerdns_zone" "this" {
|
||||
name = var.zone
|
||||
ttl = var.zone_ttl
|
||||
}
|
||||
|
||||
locals {
|
||||
records = nonsensitive({
|
||||
for record in var.records : "${record.type}#${record.name}#${md5(record.value)}" => {
|
||||
for key, value in record : key => value
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
resource "hetznerdns_record" "this" {
|
||||
for_each = local.records
|
||||
zone_id = hetznerdns_zone.this.id
|
||||
name = each.value.name
|
||||
type = each.value.type
|
||||
value = (each.value.type == "TXT"
|
||||
? "\"${join("\" \"", [for c in chunklist(split("", each.value.value), 255) : join("", c)])}\""
|
||||
: each.value.value
|
||||
)
|
||||
ttl = each.value.ttl
|
||||
}
|
||||
|
||||
0
modules/hetzner/dns/outputs.tf
Normal file
0
modules/hetzner/dns/outputs.tf
Normal file
19
modules/hetzner/dns/variables.tf
Normal file
19
modules/hetzner/dns/variables.tf
Normal file
@@ -0,0 +1,19 @@
|
||||
variable "zone" {
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "zone_ttl" {
|
||||
type = number
|
||||
default = 3600
|
||||
}
|
||||
|
||||
variable "records" {
|
||||
type = set(object({
|
||||
name = string
|
||||
value = string
|
||||
type = string
|
||||
ttl = optional(number, null)
|
||||
}))
|
||||
default = []
|
||||
}
|
||||
|
||||
10
modules/hetzner/dns/versions.tf
Normal file
10
modules/hetzner/dns/versions.tf
Normal file
@@ -0,0 +1,10 @@
|
||||
terraform {
|
||||
required_providers {
|
||||
hetznerdns = {
|
||||
source = "timohirt/hetznerdns"
|
||||
version = "2.2.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user