industry-website/dns.tf

124 lines
2.7 KiB
HCL

terraform {
required_providers {
namecheap = {
source = "namecheap/namecheap"
version = "~> 2.1.0"
}
}
backend "http" {
address = "https://asciireactor.com/api/v4/projects/101/terraform/state/industry-domain"
lock_address = "https://asciireactor.com/api/v4/projects/101/terraform/state/industry-domain/lock"
unlock_address = "https://asciireactor.com/api/v4/projects/101/terraform/state/industry-domain/lock"
lock_method = "POST"
unlock_method = "DELETE"
retry_wait_min = 5
}
}
provider "namecheap" {}
variable "apex-domain" {
type = string
default = "othoulrich.com."
}
variable "host-rproxy" {
type = string
default = "rprxy.saline.o4data.net."
}
variable "protonmail-domainkey-id" {
type = string
default = "dr2jx5mioyzdmwndxrlrsgzx3nne5vtshiheypfxy7llz4e2hwrcq"
}
variable "protonmail-verification-key" {
type = string
default = "6568aab64dccc1e888741cf9874730f7fc884a00"
}
resource "namecheap_domain_records" "top" {
domain = trim(var.apex-domain,".")
mode = "OVERWRITE"
email_type = "MX"
record {
hostname = "@"
address = var.host-rproxy
type = "ALIAS"
ttl = 300
}
record {
hostname = "www"
address = var.apex-domain
type = "CNAME"
}
record {
hostname = "code"
address = var.apex-domain
type = "CNAME"
}
record {
hostname = "@"
address = "mail.protonmail.ch."
type = "MX"
}
record {
hostname = "@"
address = "mailsec.protonmail.ch."
mx_pref = 20
type = "MX"
}
record {
hostname = "@"
address = join("=",[
"protonmail-verification",
var.protonmail-verification-key
])
type = "TXT"
}
record {
hostname = "@"
address = "v=spf1 include:_spf.protonmail.ch mx ~all"
type = "TXT"
}
record {
hostname = "protonmail._domainkey"
address = join(".",[
"protonmail.domainkey",
var.protonmail-domainkey-id,
"domains.proton.ch."
])
type = "CNAME"
}
record {
hostname = "protonmail2._domainkey"
address = join(".",[
"protonmail2.domainkey",
var.protonmail-domainkey-id,
"domains.proton.ch."
])
type = "CNAME"
}
record {
hostname = "protonmail3._domainkey"
address = join(".",[
"protonmail3.domainkey",
var.protonmail-domainkey-id,
"domains.proton.ch."
])
type = "CNAME"
}
}