mirror of
https://github.com/2martens/terraform.git
synced 2026-10-17 14:36:50 +02:00
feat: Add AWS CDN DNS records
This commit is contained in:
+4
-99
@@ -1,104 +1,9 @@
|
||||
import {
|
||||
to = module.keycloak_domain.hcloud_zone_rrset.a[0]
|
||||
id = "2martens.de/id/A"
|
||||
to = module.cdn_domain.hcloud_zone_rrset.cname
|
||||
id = "2martens.de/cdn/CNAME"
|
||||
}
|
||||
|
||||
import {
|
||||
to = module.keycloak_domain.hcloud_zone_rrset.aaaa[0]
|
||||
id = "2martens.de/id/AAAA"
|
||||
}
|
||||
|
||||
import {
|
||||
to = module.keycloak_domain.hcloud_zone_rrset.uberspace_domain_key[0]
|
||||
id = "2martens.de/uberspace._domainkey.id/TXT"
|
||||
}
|
||||
|
||||
import {
|
||||
to = module.gitea_domain.hcloud_zone_rrset.a[0]
|
||||
id = "2martens.de/git/A"
|
||||
}
|
||||
|
||||
import {
|
||||
to = module.gitea_domain.hcloud_zone_rrset.aaaa[0]
|
||||
id = "2martens.de/git/AAAA"
|
||||
}
|
||||
|
||||
import {
|
||||
to = module.helm-repo_domain.hcloud_zone_rrset.a[0]
|
||||
id = "2martens.de/repo/A"
|
||||
}
|
||||
|
||||
import {
|
||||
to = module.helm-repo_domain.hcloud_zone_rrset.aaaa[0]
|
||||
id = "2martens.de/repo/AAAA"
|
||||
}
|
||||
|
||||
import {
|
||||
to = module.statping_domain.hcloud_zone_rrset.a[0]
|
||||
id = "2martens.de/status/A"
|
||||
}
|
||||
|
||||
import {
|
||||
to = module.statping_domain.hcloud_zone_rrset.aaaa[0]
|
||||
id = "2martens.de/status/AAAA"
|
||||
}
|
||||
|
||||
import {
|
||||
to = module.personal_website_domain.hcloud_zone_rrset.a[0]
|
||||
id = "2martens.de/@/A"
|
||||
}
|
||||
|
||||
import {
|
||||
to = module.personal_website_domain.hcloud_zone_rrset.aaaa[0]
|
||||
id = "2martens.de/@/AAAA"
|
||||
}
|
||||
|
||||
import {
|
||||
to = module.personal_website_domain.hcloud_zone_rrset.uberspace_domain_key[0]
|
||||
id = "2martens.de/uberspace._domainkey/TXT"
|
||||
}
|
||||
|
||||
import {
|
||||
to = module.medium_domain.hcloud_zone_rrset.a[0]
|
||||
id = "2martens.de/medium/A"
|
||||
}
|
||||
|
||||
import {
|
||||
to = module.medium_domain.hcloud_zone_rrset.aaaa[0]
|
||||
id = "2martens.de/medium/AAAA"
|
||||
}
|
||||
|
||||
import {
|
||||
to = module.appreview_domain.hcloud_zone_rrset.mx[0]
|
||||
id = "2martens.de/appreview/MX"
|
||||
}
|
||||
|
||||
import {
|
||||
to = module.appreview_domain.hcloud_zone_rrset.txt[0]
|
||||
id = "2martens.de/appreview/TXT"
|
||||
}
|
||||
|
||||
import {
|
||||
to = module.appreview_domain.hcloud_zone_rrset.uberspace_domain_key[0]
|
||||
id = "2martens.de/uberspace._domainkey.appreview/TXT"
|
||||
}
|
||||
|
||||
import {
|
||||
to = module.cms_domain.hcloud_zone_rrset.a[0]
|
||||
id = "2martens.de/cms/A"
|
||||
}
|
||||
|
||||
import {
|
||||
to = module.cms_domain.hcloud_zone_rrset.aaaa[0]
|
||||
id = "2martens.de/cms/AAAA"
|
||||
}
|
||||
|
||||
import {
|
||||
to = module.nas_domain.hcloud_zone_rrset.a[0]
|
||||
id = "2martens.de/nas/A"
|
||||
}
|
||||
|
||||
import {
|
||||
to = module.nas_domain.hcloud_zone_rrset.aaaa[0]
|
||||
id = "2martens.de/nas/AAAA"
|
||||
to = module.cdn_domain.hcloud_zone_rrset.validation
|
||||
id = "2martens.de/_4741e2d9c8a605950eebfa048029e4ef.cdn/CNAME"
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
resource "hcloud_zone_rrset" "cname" {
|
||||
zone = var.domain
|
||||
name = var.subdomain != "" ? var.subdomain : "@"
|
||||
type = "CNAME"
|
||||
ttl = 3600
|
||||
|
||||
change_protection = true
|
||||
|
||||
records = [
|
||||
{ value = var.cname_target }
|
||||
]
|
||||
}
|
||||
|
||||
resource "hcloud_zone_rrset" "validation" {
|
||||
zone = var.domain
|
||||
name = var.subdomain != "" ? format("%s.%s", var.validation_key, var.subdomain) : var.validation_key
|
||||
type = "CNAME"
|
||||
ttl = 3600
|
||||
|
||||
change_protection = true
|
||||
|
||||
records = [
|
||||
{ value = var.validation_target }
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
variable "domain" {
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "subdomain" {
|
||||
type = string
|
||||
default = ""
|
||||
}
|
||||
|
||||
variable "cname_target" {
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "validation_key" {
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "validation_target" {
|
||||
type = string
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
terraform {
|
||||
required_providers {
|
||||
hcloud = {
|
||||
source = "hetznercloud/hcloud"
|
||||
version = ">= 1.44.1"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,8 @@ resource "hcloud_zone_rrset" "a" {
|
||||
type = "A"
|
||||
ttl = 3600
|
||||
|
||||
change_protection = true
|
||||
|
||||
records = [
|
||||
{ value = var.ipv4 }
|
||||
]
|
||||
@@ -19,6 +21,8 @@ resource "hcloud_zone_rrset" "aaaa" {
|
||||
type = "AAAA"
|
||||
ttl = 3600
|
||||
|
||||
change_protection = true
|
||||
|
||||
records = [
|
||||
{ value = var.ipv6 }
|
||||
]
|
||||
@@ -32,6 +36,8 @@ resource "hcloud_zone_rrset" "mx" {
|
||||
type = "MX"
|
||||
ttl = 3600
|
||||
|
||||
change_protection = true
|
||||
|
||||
records = [
|
||||
{ value = format("%s %s.", var.mxPrio, var.hostName) }
|
||||
]
|
||||
@@ -45,8 +51,10 @@ resource "hcloud_zone_rrset" "txt" {
|
||||
type = "TXT"
|
||||
ttl = 3600
|
||||
|
||||
change_protection = true
|
||||
|
||||
records = [
|
||||
for txtValue in var.txtValues:
|
||||
for txtValue in var.txtValues :
|
||||
{ value = provider::hcloud::txt_record(txtValue) }
|
||||
]
|
||||
}
|
||||
@@ -59,6 +67,8 @@ resource "hcloud_zone_rrset" "uberspace_domain_key" {
|
||||
type = "TXT"
|
||||
ttl = 3600
|
||||
|
||||
change_protection = true
|
||||
|
||||
records = [
|
||||
{ value = provider::hcloud::txt_record(var.uberspaceDomainKey) }
|
||||
]
|
||||
|
||||
@@ -22,3 +22,12 @@ module "nas_domain" {
|
||||
ipv4 = "31.19.63.181"
|
||||
ipv6 = "2a02:8108:c19:c400:9209:d0ff:fe70:7570"
|
||||
}
|
||||
|
||||
module "cdn_domain" {
|
||||
source = "./modules/aws_cdn"
|
||||
domain = hcloud_zone.twomartens_de.name
|
||||
subdomain = "cdn"
|
||||
cname_target = "d1fvxyvcoii67h.cloudfront.net."
|
||||
validation_key = "_4741e2d9c8a605950eebfa048029e4ef"
|
||||
validation_target = "_cf71e85bb40cc12717f2718e4590ad23.acm-validations.aws."
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user