Add Terraform Stage 1

This commit is contained in:
2023-09-14 07:09:02 +02:00
parent af3e66f901
commit f0bae5e031
23 changed files with 597 additions and 0 deletions

View File

@ -0,0 +1,14 @@
resource "cloudflare_zone" "zone" {
account_id = var.account_id
zone = var.zone
}
resource "cloudflare_record" "records" {
zone_id = cloudflare_zone.zone.id
for_each = { for record in var.records : uuidv5("dns", "${record.type}/${record.name}/${record.value}") => record } # Hackery.
name = each.value.name
value = each.value.value
type = each.value.type
ttl = 1
priority = each.value.type == "MX" ? each.value.priority : null
}

View File

@ -0,0 +1,9 @@
terraform {
required_providers {
cloudflare = {
source = "cloudflare/cloudflare"
version = "~> 4.0"
}
}
}

View File

@ -0,0 +1,10 @@
variable "account_id" {
type = string
sensitive = true
}
variable "zone" {
type = string
}
variable "records" {
type = set(object({ type = string, name = string, value = string, priority = optional(number) }))
}