-
-
Notifications
You must be signed in to change notification settings - Fork 30
/
Copy pathdomain.tf
40 lines (34 loc) · 1.08 KB
/
domain.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
data "aws_route53_zone" "default" {
name = var.domain
}
resource "aws_route53_record" "default" {
zone_id = data.aws_route53_zone.default.zone_id
name = "_amazonses.${aws_ses_domain_identity.default.id}"
type = "TXT"
ttl = "600"
records = [aws_ses_domain_identity.default.verification_token]
}
# Add Route53 MX record
resource "aws_route53_record" "mx" {
zone_id = data.aws_route53_zone.default.zone_id
name = aws_ses_domain_identity.default.id
type = "MX"
ttl = "600"
records = ["10 inbound-smtp.${var.region}.amazonaws.com"]
# Change to the region in which `aws_ses_domain_identity.default` is created
}
# Add Route53 TXT record for SPF
resource "aws_route53_record" "txt" {
zone_id = data.aws_route53_zone.default.zone_id
name = aws_ses_domain_identity.default.id
type = "TXT"
ttl = "600"
records = [var.spf]
}
resource "aws_ses_domain_identity" "default" {
domain = var.domain
}
resource "aws_ses_domain_identity_verification" "default" {
domain = aws_ses_domain_identity.default.id
depends_on = [aws_route53_record.default]
}