Skip to content

Instantly share code, notes, and snippets.

@mxro
Created April 26, 2022 22:38
Show Gist options
  • Save mxro/8e1032f41a33988c839cb5e4a394b6f3 to your computer and use it in GitHub Desktop.
Save mxro/8e1032f41a33988c839cb5e4a394b6f3 to your computer and use it in GitHub Desktop.
resource "aws_route53_record" "amazonses_verification_record" {
zone_id = data.aws_route53_zone.main.zone_id
name = "_amazonses.${var.domain}"
type = "TXT"
ttl = "600"
records = [join("", aws_ses_domain_identity.ses_domain.*.verification_token)]
}
resource "aws_ses_domain_dkim" "ses_domain_dkim" {
domain = join("", aws_ses_domain_identity.ses_domain.*.domain)
}
resource "aws_route53_record" "amazonses_dkim_record" {
count = 3
zone_id = data.aws_route53_zone.main.zone_id
name = "${element(aws_ses_domain_dkim.ses_domain_dkim.dkim_tokens, count.index)}._domainkey.${var.domain}"
type = "CNAME"
ttl = "600"
records = ["${element(aws_ses_domain_dkim.ses_domain_dkim.dkim_tokens, count.index)}.dkim.amazonses.com"]
}
resource "aws_route53_record" "spf_mail_from" {
zone_id = data.aws_route53_zone.main.zone_id
name = aws_ses_domain_mail_from.main.mail_from_domain
type = "TXT"
ttl = "600"
records = ["v=spf1 include:amazonses.com -all"]
}
resource "aws_route53_record" "spf_domain" {
zone_id = data.aws_route53_zone.main.zone_id
name = var.domain
type = "TXT"
ttl = "600"
records = ["v=spf1 include:amazonses.com -all"]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment