summaryrefslogtreecommitdiff
path: root/terranix/cloudflare/dns.nix
diff options
context:
space:
mode:
authorseth <[email protected]>2023-12-27 04:49:26 -0500
committerseth <[email protected]>2023-12-27 05:09:07 -0500
commit773d59f2606c924de218d8d5bdfadcc875084047 (patch)
tree10bd52f58715adb47dcf87993885d2b3989d85c5 /terranix/cloudflare/dns.nix
parent6f2a3fc6e3e20e719a4d570d883d64023db00653 (diff)
terranix: better handle deployments
Diffstat (limited to 'terranix/cloudflare/dns.nix')
-rw-r--r--terranix/cloudflare/dns.nix64
1 files changed, 64 insertions, 0 deletions
diff --git a/terranix/cloudflare/dns.nix b/terranix/cloudflare/dns.nix
new file mode 100644
index 0000000..9618019
--- /dev/null
+++ b/terranix/cloudflare/dns.nix
@@ -0,0 +1,64 @@
+{lib, ...}: let
+ mkRecord = name: {
+ value,
+ type,
+ ...
+ } @ args:
+ {
+ name = args.name or name;
+ zone_id = lib.tfRef "var.zone_id";
+ ttl = 1;
+ inherit value type;
+ }
+ // lib.optionalAttrs (type != "TXT") {proxied = true;};
+
+ atlas_tunnel = lib.tfRef "data.cloudflare_tunnel.atlas-nginx.id" + ".cfargotunnel.com";
+in {
+ resource.cloudflare_record = builtins.mapAttrs mkRecord {
+ website = {
+ name = "@";
+ value = "website-86j.pages.dev";
+ type = "CNAME";
+ };
+
+ www = {
+ value = "mydadleft.me";
+ type = "CNAME";
+ };
+
+ api = {
+ value = "teawieapi.pages.dev";
+ type = "CNAME";
+ };
+
+ miniflux = {
+ value = atlas_tunnel;
+ type = "CNAME";
+ };
+
+ msix = {
+ value = atlas_tunnel;
+ type = "CNAME";
+ };
+
+ # prevent email spoofing
+
+ dmarc = {
+ name = "_dmarc";
+ value = "v=DMARC1; p=reject; sp=reject; adkim=s; aspf=s;";
+ type = "TXT";
+ };
+
+ domainkey = {
+ name = "*._domainkey";
+ value = "v=DKIM1; p=";
+ type = "TXT";
+ };
+
+ email = {
+ name = "mydadleft.me";
+ value = "v=spf1 -all";
+ type = "TXT";
+ };
+ };
+}