bsmsapp/terraform/modules/ses/main.tf

54 lines
1.7 KiB
HCL

# ------------------------------------------------------------------------------
# Amazon SES
# ------------------------------------------------------------------------------
resource "aws_ses_domain_identity" "this" {
domain = var.domain
}
resource "aws_ses_domain_mail_from" "this" {
domain = aws_ses_domain_identity.this.domain
mail_from_domain = "mail.${var.domain}"
}
# hacer for_each
# 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"]
# }
# creo que solo con este spf estamos
resource "aws_route53_record" "this" {
# zone_id = data.aws_route53_zone.this.zone_id
zone_id = var.zone_id
name = var.domain
type = "TXT"
ttl = "600"
records = ["v=spf1 include:amazonses.com -all"]
}