mail: move all config from ses.tf to mail.tf

Also add two emails:
 - dapps-staking@status.im
 - dapps-approvals@status.im

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2020-02-04 15:54:39 +01:00
parent 23cd4e9b22
commit 6c2067ae17
No known key found for this signature in database
GPG Key ID: 4EF064D0E6D63020
3 changed files with 76 additions and 68 deletions

View File

@ -31,7 +31,7 @@ The `dap.ps` domain is registered via [Gandi](https://www.gandi.net/) DNS provid
## EMail
There are no mailboxes for `dap.ps` domain. We forward emails using AWS Lambda and AWS SES. You can change the forwarding rules by editing the `defaultConfig` object in [`files/sesforwarder.js`](files/sesforwarder/index.js).
There are no mailboxes for `dap.ps` domain. We forward emails using AWS Lambda and AWS SES. You can change the forwarding rules by editing the `defaultConfig` object in [`files/sesforwarder.js`](files/sesforwarder/index.js) and adding [Verified Emails](https://www.terraform.io/docs/providers/aws/r/ses_email_identity.html) in [`mail.tf`](mail.tf).
# Usage

75
mail.tf
View File

@ -139,3 +139,78 @@ resource "aws_ses_receipt_rule" "ses_forwarder" {
}
}
/* Validated Domain -----------------------------*/
resource "aws_ses_domain_identity" "dap_ps" {
domain = var.public_domain
}
resource "aws_ses_domain_dkim" "dap_ps" {
domain = aws_ses_domain_identity.dap_ps.domain
}
resource "aws_ses_domain_mail_from" "dap_ps" {
domain = aws_ses_domain_identity.dap_ps.domain
mail_from_domain = "mail.${aws_ses_domain_identity.dap_ps.domain}"
}
resource "aws_route53_record" "dap_ps_verification" {
zone_id = aws_route53_zone.dap_ps.zone_id
name = "_amazonses"
type = "TXT"
ttl = 3600
records = ["${aws_ses_domain_identity.dap_ps.verification_token}"]
}
resource "aws_route53_record" "dap_ps_mail_mx" {
zone_id = aws_route53_zone.dap_ps.zone_id
name = "mail"
type = "MX"
ttl = 3600
records = ["10 feedback-smtp.us-east-1.amazonses.com."]
}
resource "aws_route53_record" "dap_ps_mail_spf" {
zone_id = aws_route53_zone.dap_ps.zone_id
name = "mail"
type = "TXT"
ttl = 3600
records = ["v= spf1 include:amazonses.com ~all"]
}
resource "aws_route53_record" "dap_ps_dkim" {
zone_id = aws_route53_zone.dap_ps.zone_id
ttl = 3600
type = "CNAME"
count = 3
name = "${element(aws_ses_domain_dkim.dap_ps.dkim_tokens, count.index)}._domainkey"
records = ["${element(aws_ses_domain_dkim.dap_ps.dkim_tokens, count.index)}.dkim.amazonses.com."]
}
/* SES EMail Fowarding --------------------------*/
resource "aws_route53_record" "dap_ps_mx" {
zone_id = aws_route53_zone.dap_ps.zone_id
name = "@"
type = "MX"
ttl = 3600
records = ["10 inbound-smtp.us-east-1.amazonaws.com."]
}
/* Validated Emails -----------------------------*/
resource "aws_ses_email_identity" "jakub" {
email = "jakub@status.im"
}
resource "aws_ses_email_identity" "andy" {
email = "andy@status.im"
}
resource "aws_ses_email_identity" "dapps-staking" {
email = "dapps-staking@status.im"
}
resource "aws_ses_email_identity" "dapps-approvals" {
email = "dapps-approvals@status.im"
}

67
ses.tf
View File

@ -1,67 +0,0 @@
/* Validated Domain -----------------------------*/
resource "aws_ses_domain_identity" "dap_ps" {
domain = var.public_domain
}
resource "aws_ses_domain_dkim" "dap_ps" {
domain = aws_ses_domain_identity.dap_ps.domain
}
resource "aws_ses_domain_mail_from" "dap_ps" {
domain = aws_ses_domain_identity.dap_ps.domain
mail_from_domain = "mail.${aws_ses_domain_identity.dap_ps.domain}"
}
resource "aws_route53_record" "dap_ps_verification" {
zone_id = aws_route53_zone.dap_ps.zone_id
name = "_amazonses"
type = "TXT"
ttl = 3600
records = ["${aws_ses_domain_identity.dap_ps.verification_token}"]
}
resource "aws_route53_record" "dap_ps_mail_mx" {
zone_id = aws_route53_zone.dap_ps.zone_id
name = "mail"
type = "MX"
ttl = 3600
records = ["10 feedback-smtp.us-east-1.amazonses.com."]
}
resource "aws_route53_record" "dap_ps_mail_spf" {
zone_id = aws_route53_zone.dap_ps.zone_id
name = "mail"
type = "TXT"
ttl = 3600
records = ["v= spf1 include:amazonses.com ~all"]
}
resource "aws_route53_record" "dap_ps_dkim" {
zone_id = aws_route53_zone.dap_ps.zone_id
ttl = 3600
type = "CNAME"
count = 3
name = "${element(aws_ses_domain_dkim.dap_ps.dkim_tokens, count.index)}._domainkey"
records = ["${element(aws_ses_domain_dkim.dap_ps.dkim_tokens, count.index)}.dkim.amazonses.com."]
}
/* SES EMail Fowarding --------------------------*/
resource "aws_route53_record" "dap_ps_mx" {
zone_id = aws_route53_zone.dap_ps.zone_id
name = "@"
type = "MX"
ttl = 3600
records = ["10 inbound-smtp.us-east-1.amazonaws.com."]
}
/* Validated Emails -----------------------------*/
resource "aws_ses_email_identity" "jakub" {
email = "jakub@status.im"
}
resource "aws_ses_email_identity" "andy" {
email = "andy@status.im"
}