Skip to content

Commit d91b8cf

Browse files
committed
fix(ses-identity): support exceptional regional dkim domain
1 parent 8c4a9f4 commit d91b8cf

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

modules/ses-identity/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ This module creates following resources.
3737
| [aws_sesv2_email_identity_feedback_attributes.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/sesv2_email_identity_feedback_attributes) | resource |
3838
| [aws_sesv2_email_identity_mail_from_attributes.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/sesv2_email_identity_mail_from_attributes) | resource |
3939
| [aws_sesv2_email_identity_policy.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/sesv2_email_identity_policy) | resource |
40+
| [aws_region.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/region) | data source |
4041

4142
## Inputs
4243

modules/ses-identity/route53.tf

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,22 @@ locals {
44
? aws_sesv2_email_identity.this.dkim_signing_attributes[0].tokens
55
: []
66
)
7+
# INFO: https://docs.aws.amazon.com/general/latest/gr/ses.html#ses_dkim_domains
8+
# - Not all AWS Regions use the default SES DKIM domain, `dkim.amazonses.com`
9+
dkim_domains = {
10+
"default" = "dkim.amazonses.com"
11+
"af-south-1" = "dkim.af-south-1.amazonses.com"
12+
"ap-southeast-3" = "dkim.ap-southeast-3.amazonses.com"
13+
"ap-northeast-3" = "dkim.ap-northeast-3.amazonses.com"
14+
"eu-south-1" = "dkim.eu-south-1.amazonses.com"
15+
"il-central-1" = "dkim.il-central-1.amazonses.com"
16+
"us-gov-east-1" = "dkim.us-gov-east-1.amazonses.com"
17+
}
18+
dkim_domain = lookup(local.dkim_domains, data.aws_region.current.name, local.dkim_domains["default"])
719
}
820

21+
data "aws_region" "current" {}
22+
923

1024
###################################################
1125
# DKIM Verification
@@ -17,7 +31,7 @@ resource "aws_route53_record" "dkim" {
1731
zone_id = var.dkim.verification.zone_id
1832
name = "${local.tokens[count.index]}._domainkey.${aws_sesv2_email_identity.this.email_identity}"
1933
type = "CNAME"
20-
records = ["${local.tokens[count.index]}.dkim.amazonses.com"]
34+
records = ["${local.tokens[count.index]}.${local.dkim_domain}"]
2135

2236
ttl = "600"
2337
allow_overwrite = true

0 commit comments

Comments
 (0)