Provides an SES domain DKIM generation resource.
Domain ownership needs to be confirmed first using ses_domain_identity Resource
This resource supports the following arguments:
domain
- (Required) Verified domain name to generate DKIM tokens for.This resource exports the following attributes in addition to the arguments above:
dkim_tokens
- DKIM tokens generated by SES.
These tokens should be used to create CNAME records used to verify SES Easy DKIM.
See below for an example of how this might be achieved
when the domain is hosted in Route 53 and managed by Terraform.
Find out more about verifying domains in Amazon SES
in the AWS SES docs.resource "aws_ses_domain_identity" "example" {
domain = "example.com"
}
resource "aws_ses_domain_dkim" "example" {
domain = aws_ses_domain_identity.example.domain
}
resource "aws_route53_record" "example_amazonses_dkim_record" {
count = 3
zone_id = "ABCDEFGHIJ123"
name = "${aws_ses_domain_dkim.example.dkim_tokens[count.index]}._domainkey"
type = "CNAME"
ttl = "600"
records = ["${aws_ses_domain_dkim.example.dkim_tokens[count.index]}.dkim.amazonses.com"]
}
In Terraform v1.5.0 and later, use an import
block to import DKIM tokens using the domain
attribute. For example:
import {
to = aws_ses_domain_dkim.example
id = "example.com"
}
Using terraform import
, import DKIM tokens using the domain
attribute. For example:
% terraform import aws_ses_domain_dkim.example example.com