Search code examples
amazon-web-servicesterraformdevopsamazon-route53amazon-ses

SES not verifying domain


I have an issue with the domain verification on SES, I created a module which is responsible to create a domain on SES and put the TXT records on the hosted zone route53. even tho the domain status on SES still on "Pending Verification".

my module use thes resources:

    resource "aws_ses_domain_identity" "domain" {
       domain = var.domain
    }

    resource "aws_route53_record" "domain_amazonses_verification_record" {
      count   = var.zone_id != "" ? 1 : 0
      zone_id = var.zone_id
      name    = format("_amazonses.%s", var.domain)
      type    = "TXT"
      ttl     = var.ses_ttl
      records = [aws_ses_domain_identity.domain.verification_token]
    }

#main.tf        
     module "my-module" {
          source = "./modules/myses"
          domain = "mydomain.com"
          zone_id = var.zoneId
        }

did I miss something?


Solution

  • I believe you are missing the aws_ses_domain_identity_verification resource.

    resource "aws_ses_domain_identity_verification" "example_verification" {
      domain = aws_ses_domain_identity.domain.id
    
      depends_on = [aws_route53_record.domain_amazonses_verification_record]
    }