Repository navigation
Add custom MAIL FROM support to the ses module - #297
Merged
Merged
Conversation
Contributor
|
Terraform plan in terraform Plan: 3 to add, 0 to change, 0 to destroy.Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
+ create
Terraform will perform the following actions:
# module.food-oasis.module.ses_foodoasis_net.aws_route53_record.mail_from["mx"] will be created
+ resource "aws_route53_record" "mail_from" {
+ allow_overwrite = (known after apply)
+ fqdn = (known after apply)
+ id = (known after apply)
+ name = "bounce.foodoasis.net"
+ records = [
+ "10 feedback-smtp.us-west-2.amazonses.com",
]
+ ttl = 1800
+ type = "MX"
+ zone_id = "********************"
}
# module.food-oasis.module.ses_foodoasis_net.aws_route53_record.mail_from["spf"] will be created
+ resource "aws_route53_record" "mail_from" {
+ allow_overwrite = (known after apply)
+ fqdn = (known after apply)
+ id = (known after apply)
+ name = "bounce.foodoasis.net"
+ records = [
+ "\"v=spf1 include:amazonses.com ~all\"",
]
+ ttl = 1800
+ type = "TXT"
+ zone_id = "********************"
}
# module.food-oasis.module.ses_foodoasis_net.aws_sesv2_email_identity_mail_from_attributes.this[0] will be created
+ resource "aws_sesv2_email_identity_mail_from_attributes" "this" {
+ behavior_on_mx_failure = "USE_DEFAULT_VALUE"
+ email_identity = "*************"
+ id = (known after apply)
+ mail_from_domain = "bounce.foodoasis.net"
+ region = "us-west-2"
}
Plan: 3 to add, 0 to change, 0 to destroy.❌ Error applying plan in Terraform apply (OIDC) #122 |
ale210
added a commit
that referenced
this pull request
Nov 20, 2026
Fixes the failed apply from #297. `modules/ses` quoted the SPF TXT value itself, but the AWS provider already adds the quotes Route 53 needs, so Route 53 received `""v=spf1 include:amazonses.com ~all""` and rejected it with `InvalidCharacterString`. The MAIL FROM attributes and the MX record were created; the TXT record was not. This writes the value unquoted, the same way the other TXT records in the repo are written. Expected plan: 1 to add (the `bounce.foodoasis.net` TXT record), 0 to change, 0 to destroy. Mail is unaffected meanwhile: the MAIL FROM status is `PENDING` and `USE_DEFAULT_VALUE` keeps SES on its own envelope sender.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds optional custom MAIL FROM support to
modules/sesand turns it on for Food Oasis asbounce.foodoasis.net.Without it, SES sends with its own
amazonses.comenvelope sender, so SPF doesn't align with the From domain and the SES console warns "MAIL FROM record is not aligned". DMARC already passes through DKIM; this adds SPF as a second aligned path.mail_from_subdomainvariable (default null, so existing callers are unchanged). When set, the module configures the identity's MAIL FROM domain withUSE_DEFAULT_VALUEon MX failure, and writes the MX (feedback-smtp.<region>.amazonses.com) and SPF records intozone_id. A newmail_from_recordsoutput lists them for zone-less use.projects/food-oasis/ses.tfsetsmail_from_subdomain = "bounce".Expected plan: 3 to add (the MAIL FROM attributes, MX, TXT), 0 to change, 0 to destroy.
The
foodoasis.netnameservers still point at the Food Oasis account's zone, so the MX and TXT records get copied there by hand after the apply (mirroring rule, #284). The Food Oasis account's own identity stays on SES's default MAIL FROM.