-
Notifications
You must be signed in to change notification settings - Fork 3
/
main.tf
63 lines (54 loc) · 1.56 KB
/
main.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
resource "cloudflare_record" "mx1" {
zone_id = var.zone_id
name = "@"
type = "MX"
value = "in1-smtp.messagingengine.com"
priority = 10
}
resource "cloudflare_record" "mx2" {
zone_id = var.zone_id
name = "@"
type = "MX"
value = "in2-smtp.messagingengine.com"
priority = 20
}
resource "cloudflare_record" "dkim1" {
zone_id = var.zone_id
name = "fm1._domainkey"
type = "CNAME"
value = "fm1.${var.zone_name}.dkim.fmhosted.com"
}
resource "cloudflare_record" "dkim2" {
zone_id = var.zone_id
name = "fm2._domainkey"
type = "CNAME"
value = "fm2.${var.zone_name}.dkim.fmhosted.com"
}
resource "cloudflare_record" "dkim3" {
zone_id = var.zone_id
name = "fm3._domainkey"
type = "CNAME"
value = "fm3.${var.zone_name}.dkim.fmhosted.com"
}
resource "cloudflare_record" "spf" {
zone_id = var.zone_id
name = "@"
value = "v=spf1 ${join(" ", concat(["include:spf.messagingengine.com"], var.spf_terms, ["-all"]))}"
type = "TXT"
}
resource "cloudflare_record" "dmarc" {
zone_id = var.zone_id
name = "_dmarc"
value = "v=DMARC1; p=reject; rua=mailto:${join(",mailto:", var.dmarc_rua)}; ruf=mailto:${join(",mailto:", var.dmarc_ruf)}; fo=1:d:s"
type = "TXT"
}
module "mta_sts" {
source = "rsclarke/mta-sts/cloudflare"
version = "~> 1.1.0"
zone_id = var.zone_id
zone_name = var.zone_name
mode = var.mta_sts_mode
mx = concat([cloudflare_record.mx1.value, cloudflare_record.mx2.value], var.mta_sts_mx)
max_age = var.mta_sts_max_age
rua = var.tlsrpt_rua
}