diff options
author | clarkzjw <[email protected]> | 2023-01-13 17:16:35 -0800 |
---|---|---|
committer | clarkzjw <[email protected]> | 2023-01-13 17:16:35 -0800 |
commit | 1a593322441e713ff937cb905aea7aab1d951161 (patch) | |
tree | f4cea3db6ccd0a89aabdfcacc5171e61e27dff40 | |
parent | a077d65e5f7f415cc17abeee2264e24957ef97cd (diff) | |
download | homelab-1a593322441e713ff937cb905aea7aab1d951161.tar.gz |
add mailgun domain config
-rw-r--r-- | clarkzjw.cc/infra/cloudflare.tf | 43 | ||||
-rw-r--r-- | clarkzjw.cc/infra/terraform.tfvars.example | 1 | ||||
-rw-r--r-- | clarkzjw.cc/infra/variables.tf | 5 |
3 files changed, 49 insertions, 0 deletions
diff --git a/clarkzjw.cc/infra/cloudflare.tf b/clarkzjw.cc/infra/cloudflare.tf index f269129..61d9868 100644 --- a/clarkzjw.cc/infra/cloudflare.tf +++ b/clarkzjw.cc/infra/cloudflare.tf | |||
@@ -4,6 +4,7 @@ data "cloudflare_zones" "homelab_main_domain" { | |||
4 | } | 4 | } |
5 | } | 5 | } |
6 | 6 | ||
7 | # www | ||
7 | variable "homelab_www_domain" { | 8 | variable "homelab_www_domain" { |
8 | default = "clarkzjw.cc" | 9 | default = "clarkzjw.cc" |
9 | } | 10 | } |
@@ -21,3 +22,45 @@ resource "cloudflare_record" "main" { | |||
21 | ttl = 1 | 22 | ttl = 1 |
22 | proxied = true | 23 | proxied = true |
23 | } | 24 | } |
25 | |||
26 | # notify | ||
27 | resource "cloudflare_record" "notify_SPF" { | ||
28 | zone_id = data.cloudflare_zones.homelab_main_domain.zones[0].id | ||
29 | # type = "SPF" causes DNS Validation Error (1004) | ||
30 | # https://github.com/cloudflare/terraform-provider-cloudflare/issues/1473 | ||
31 | type = "TXT" | ||
32 | name = "notify.${var.homelab_main_domain}" | ||
33 | value = "v=spf1 include:mailgun.org ~all" | ||
34 | |||
35 | ttl = 1 | ||
36 | } | ||
37 | |||
38 | resource "cloudflare_record" "notify_DKIM" { | ||
39 | name = "pic._domainkey.notify.${var.homelab_main_domain}" | ||
40 | type = "TXT" | ||
41 | zone_id = data.cloudflare_zones.homelab_main_domain.zones[0].id | ||
42 | value = var.homelab_notify_DKIM | ||
43 | } | ||
44 | |||
45 | resource "cloudflare_record" "notify_CNAME" { | ||
46 | name = "email.notify.${var.homelab_main_domain}" | ||
47 | type = "CNAME" | ||
48 | zone_id = data.cloudflare_zones.homelab_main_domain.zones[0].id | ||
49 | value = "mailgun.org" | ||
50 | } | ||
51 | |||
52 | resource "cloudflare_record" "notify_MX_a" { | ||
53 | name = "notify.${var.homelab_main_domain}" | ||
54 | type = "MX" | ||
55 | zone_id = data.cloudflare_zones.homelab_main_domain.zones[0].id | ||
56 | value = "mxa.mailgun.org" | ||
57 | priority = 10 | ||
58 | } | ||
59 | |||
60 | resource "cloudflare_record" "notify_MX_b" { | ||
61 | name = "notify.${var.homelab_main_domain}" | ||
62 | type = "MX" | ||
63 | zone_id = data.cloudflare_zones.homelab_main_domain.zones[0].id | ||
64 | value = "mxb.mailgun.org" | ||
65 | priority = 10 | ||
66 | } | ||
diff --git a/clarkzjw.cc/infra/terraform.tfvars.example b/clarkzjw.cc/infra/terraform.tfvars.example new file mode 100644 index 0000000..6fd3085 --- /dev/null +++ b/clarkzjw.cc/infra/terraform.tfvars.example | |||
@@ -0,0 +1 @@ | |||
homelab_notify_DKIM = "k=rsa; p=xxx" | |||
diff --git a/clarkzjw.cc/infra/variables.tf b/clarkzjw.cc/infra/variables.tf index faa527e..22f201a 100644 --- a/clarkzjw.cc/infra/variables.tf +++ b/clarkzjw.cc/infra/variables.tf | |||
@@ -2,3 +2,8 @@ variable "homelab_main_domain" { | |||
2 | description = "HomeLab Main Domain" | 2 | description = "HomeLab Main Domain" |
3 | default = "clarkzjw.cc" | 3 | default = "clarkzjw.cc" |
4 | } | 4 | } |
5 | |||
6 | variable "homelab_notify_DKIM" { | ||
7 | description = "DKIM domain value from Mailgun" | ||
8 | default = "k=rsa; p=xxxx" | ||
9 | } \ No newline at end of file | ||