add fastmail records to islan.me in dnsimple
diff --git a/.terraform.lock.hcl b/.terraform.lock.hcl
index 968b360..af14f15 100644
--- a/.terraform.lock.hcl
+++ b/.terraform.lock.hcl
@@ -1,6 +1,29 @@
# This file is maintained automatically by "terraform init".
# Manual edits may be lost in future updates.
+provider "registry.terraform.io/dnsimple/dnsimple" {
+ version = "1.10.0"
+ constraints = "1.10.0"
+ hashes = [
+ "h1:UOCA/dFp2ORSVi/WlCCZrjjfXPUy9vpgk4PEBv6h4w0=",
+ "zh:025dbad287c9a9ca61b84fc4a14d3f595dbbc1139d5cf034597922264b756f6f",
+ "zh:0c2fa8513004732f3aae6a408eb68ff9c2ad119f8bcefe491f0420ad0f4fe7d5",
+ "zh:1ebb4cebfc29dfd8dd7f4a03f57aebe118a9dda15caf17eace06a16b40507317",
+ "zh:5585c10af512519f006491bec5e63504e3682f61af4ab4c4807721de7764bf0f",
+ "zh:571ead8072d43334d8ac169c86da21c9b325439508344898988f925f89ea7593",
+ "zh:5bdd4d83e0831f0094f06c9d56aed7e1388967e9f4f4144d69c5c37d3d170e45",
+ "zh:67982e17e937d71c1b2c83d740cd37a28c9c6ad16d325dddb91327303d6e96ff",
+ "zh:7de0afaaed2668c27c7189180ceda3bc73e17b21a150ecec8eb3979e95875323",
+ "zh:88911647fc4f8eaac3699b72ca7a0bee8f33521725b839b20235138f5072bfb7",
+ "zh:8ad2a7f599864602e3126a9c31ec28b8c277090e98f80cd0d5e29eddb1bebae1",
+ "zh:ac47ee0fd0837b57945fe961656f1f8e3c20e31178c49aafa7836b93aa5966a6",
+ "zh:acdc1a9a5553d8d0e7aa887acfa0cf440f9c428dabc0c46b61d1b3eae6443e09",
+ "zh:b3e3d236b72b5d975098f29e42a8eff071064de99cd81b27e264e5641aed7365",
+ "zh:d21daf975282bdddc7c66580d0fde5395a0ed67fdfe3c3c87aec952a6604ba24",
+ "zh:f809ab383cca0a5f83072981c64208cbd7fa67e986a86ee02dd2c82333221e32",
+ ]
+}
+
provider "registry.terraform.io/linode/linode" {
version = "2.41.1"
constraints = "~> 2.18"
diff --git a/dnsimple.tf b/dnsimple.tf
new file mode 100644
index 0000000..e7e4720
--- /dev/null
+++ b/dnsimple.tf
@@ -0,0 +1,62 @@
+# https://www.fastmail.help/hc/en-us/articles/360060591153-Manual-DNS-configuration
+
+resource "dnsimple_zone" "islan_me" {
+ name = "islan.me"
+ active = true
+}
+
+resource "dnsimple_zone_record" "islan_me_mx" {
+ for_each = {
+ mx1 = { value = "in1-smtp.messagingengine.com", priority = 10 }
+ mx2 = { value = "in2-smtp.messagingengine.com", priority = 20 }
+ }
+
+ zone_name = dnsimple_zone.islan_me.name
+ name = ""
+ value = each.value.value
+ type = "MX"
+ priority = each.value.priority
+}
+
+resource "dnsimple_zone_record" "islan_me_spf" {
+ zone_name = dnsimple_zone.islan_me.name
+ name = ""
+ value = "v=spf1 include:spf.messagingengine.com ?all"
+ type = "TXT"
+}
+
+resource "dnsimple_zone_record" "islan_me_dkim" {
+ for_each = toset(["fm1", "fm2", "fm3"])
+
+ zone_name = dnsimple_zone.islan_me.name
+ name = "${each.key}._domainkey"
+ value = "${each.key}.islan.me.dkim.fmhosted.com"
+ type = "CNAME"
+}
+
+resource "dnsimple_zone_record" "islan_me_dmarc" {
+ zone_name = dnsimple_zone.islan_me.name
+ name = "_dmarc"
+ value = "v=DMARC1; p=none;"
+ type = "TXT"
+}
+
+resource "dnsimple_zone_record" "islan_me_autodiscover" {
+ for_each = {
+ submission = { priority = 0, weight = 0, port = 0, target = "." }
+ submissions = { priority = 0, weight = 1, port = 465, target = "smtp.fastmail.com" }
+ imap = { priority = 0, weight = 0, port = 0, target = "." }
+ imaps = { priority = 0, weight = 1, port = 993, target = "imap.fastmail.com" }
+ pop3 = { priority = 0, weight = 0, port = 0, target = "." }
+ pop3s = { priority = 10, weight = 1, port = 995, target = "pop.fastmail.com" }
+ jmap = { priority = 0, weight = 1, port = 443, target = "api.fastmail.com" }
+ autodiscover = { priority = 0, weight = 1, port = 443, target = "autodiscover.fastmail.com" }
+ }
+
+ zone_name = dnsimple_zone.islan_me.name
+ name = "_${each.key}._tcp"
+ value = "${each.value.weight} ${each.value.port} ${each.value.target}"
+ priority = each.value.priority
+ type = "SRV"
+}
+
diff --git a/main.tf b/main.tf
index a82adfd..f370204 100644
--- a/main.tf
+++ b/main.tf
@@ -7,13 +7,18 @@ terraform {
}
required_providers {
+ dnsimple = {
+ source = "dnsimple/dnsimple"
+ version = "1.10.0"
+ }
+
linode = {
source = "linode/linode"
version = "~> 2.18"
}
pihole = {
- source = "ryanwholey/pihole"
+ source = "ryanwholey/pihole"
# https://github.com/ryanwholey/terraform-provider-pihole/issues/86#issuecomment-2828469631
version = "2.0.0-beta.1"
@@ -26,6 +31,11 @@ terraform {
}
}
+provider "dnsimple" {
+ token = "${var.dnsimple.token}"
+ account = "${var.dnsimple.account}"
+}
+
provider "linode" {
# token = LINODE_TOKEN
}
@@ -42,6 +52,14 @@ provider "tailscale" {
# oauth_client_secret = TAILSCALE_OAUTH_CLIENT_SECRET
}
+variable "dnsimple" {
+ type = object({
+ token = string
+ account = string
+ })
+ nullable = false
+}
+
variable "soa_email" {
type = string
nullable = false