Skip to content

Resource: awsSesDomainDkim

Provides an SES domain DKIM generation resource.

Domain ownership needs to be confirmed first using ses_domain_identity Resource

Argument Reference

The following arguments are supported:

  • domain - (Required) Verified domain name to generate DKIM tokens for.

Attributes Reference

In addition to all arguments above, the following attributes are exported:

  • dkimTokens - 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.

Example Usage

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
const awsSesDomainIdentityExample = new aws.sesDomainIdentity.SesDomainIdentity(
  this,
  "example",
  {
    domain: "example.com",
  }
);
const awsSesDomainDkimExample = new aws.sesDomainDkim.SesDomainDkim(
  this,
  "example_1",
  {
    domain: awsSesDomainIdentityExample.domain,
  }
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
awsSesDomainDkimExample.overrideLogicalId("example");
const awsRoute53RecordExampleAmazonsesDkimRecord =
  new aws.route53Record.Route53Record(this, "example_amazonses_dkim_record", {
    name: `\${${awsSesDomainDkimExample.dkimTokens.fqn}[count.index]}._domainkey`,
    records: [
      `\${${awsSesDomainDkimExample.dkimTokens.fqn}[count.index]}.dkim.amazonses.com`,
    ],
    ttl: "600",
    type: "CNAME",
    zoneId: "ABCDEFGHIJ123",
  });
/*In most cases loops should be handled in the programming language context and 
not inside of the Terraform context. If you are looping over something external, e.g. a variable or a file input
you should consider using a for loop. If you are looping over something only known to Terraform, e.g. a result of a data source
you need to keep this like it is.*/
awsRoute53RecordExampleAmazonsesDkimRecord.addOverride("count", 3);

Import

DKIM tokens can be imported using the domain attribute, e.g.,

$ terraform import aws_ses_domain_dkim.example example.com