-
Notifications
You must be signed in to change notification settings - Fork 3
/
main.tf
38 lines (33 loc) · 981 Bytes
/
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
resource "aws_ses_domain_identity" "this" {
domain = var.domain
}
resource "aws_ses_domain_identity_verification" "this" {
domain = aws_ses_domain_identity.this.id
depends_on = [cloudflare_record.domain_verification]
}
resource "aws_ses_domain_dkim" "this" {
domain = var.domain
}
resource "cloudflare_record" "domain_verification" {
zone_id = var.zone_id
name = "_amazonses.${aws_ses_domain_identity.this.id}"
type = "TXT"
value = aws_ses_domain_identity.this.verification_token
}
resource "cloudflare_record" "dkim" {
zone_id = var.zone_id
count = 3
name = format(
"%s._domainkey.%s",
element(aws_ses_domain_dkim.this.dkim_tokens, count.index),
var.domain,
)
type = "CNAME"
value = "${element(aws_ses_domain_dkim.this.dkim_tokens, count.index)}.dkim.amazonses.com"
}
resource "cloudflare_record" "spf" {
zone_id = var.zone_id
name = var.domain
type = "TXT"
value = "v=spf1 include:amazonses.com -all"
}