-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathemail_dns.tf
56 lines (47 loc) · 1.18 KB
/
email_dns.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
# ses domain
resource "aws_ses_domain_identity" "ms" {
domain = var.domain
}
resource "aws_route53_record" "ms-domain-identity-records" {
zone_id = var.zone_id
name = "_amazonses.${var.domain}"
type = "TXT"
ttl = "600"
records = [
aws_ses_domain_identity.ms.verification_token,
]
}
# ses dkim
resource "aws_ses_domain_dkim" "ms" {
domain = aws_ses_domain_identity.ms.domain
}
resource "aws_route53_record" "ms-dkim-records" {
count = 3
zone_id = var.zone_id
name = "${element(aws_ses_domain_dkim.ms.dkim_tokens, count.index)}._domainkey.${var.domain}"
type = "CNAME"
ttl = "600"
records = [
"${element(aws_ses_domain_dkim.ms.dkim_tokens, count.index)}.dkim.amazonses.com",
]
}
# ses mail to records
resource "aws_route53_record" "ms-mx-records" {
zone_id = var.zone_id
name = var.domain
type = "MX"
ttl = "600"
records = [
"10 inbound-smtp.${var.region}.amazonses.com",
"10 inbound-smtp.${var.region}.amazonaws.com",
]
}
resource "aws_route53_record" "ms-spf-records" {
zone_id = var.zone_id
name = var.domain
type = "TXT"
ttl = "600"
records = [
"v=spf1 include:amazonses.com -all",
]
}