This repository has been archived by the owner on Nov 1, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Imported SES resources for root domain (#162)
* added shim SES terraform resources * Imported SES resources for root domain * SES: Don't hardcode number of DNS records used for DKIM verification This could potentially change so it's better to not hardcode it. * Added SES domain identity ARN output This will be handy when I'll create the IAM user to make the IAM policy more specific. The `ses:SendEmail` action in IAM supports the SES domain idenity ARN as resource: https://iam.cloudonaut.io/reference/ses/SendEmail.html
- Loading branch information
Showing
5 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
variable "domain" {} | ||
|
||
variable "aws_route53_zone_id" {} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
resource "aws_ses_domain_identity" "domain" { | ||
domain = "${var.domain}" | ||
} | ||
|
||
# SES Verification: TXT Record | ||
resource "aws_route53_record" "amazonses_verification_record" { | ||
zone_id = "${var.aws_route53_zone_id}" | ||
|
||
name = "_amazonses.${aws_ses_domain_identity.domain.id}" | ||
|
||
type = "TXT" | ||
ttl = "1800" | ||
|
||
records = [ | ||
"${aws_ses_domain_identity.domain.verification_token}", | ||
] | ||
} | ||
|
||
resource "aws_ses_domain_identity_verification" "amazonses_verification" { | ||
domain = "${aws_ses_domain_identity.domain.id}" | ||
|
||
depends_on = ["aws_route53_record.amazonses_verification_record"] | ||
} | ||
|
||
# SES Verification: DKIM | ||
resource "aws_ses_domain_dkim" "domain_verification" { | ||
domain = "${aws_ses_domain_identity.domain.domain}" | ||
} | ||
|
||
resource "aws_route53_record" "domain_amazonses_dkim_verification_record" { | ||
count = "${length(aws_ses_domain_dkim.domain_verification.dkim_tokens)}" | ||
zone_id = "${var.aws_route53_zone_id}" | ||
name = "${element(aws_ses_domain_dkim.domain_verification.dkim_tokens, count.index)}._domainkey.${aws_ses_domain_identity.domain.domain}" | ||
type = "CNAME" | ||
ttl = "1800" | ||
records = ["${element(aws_ses_domain_dkim.domain_verification.dkim_tokens, count.index)}.dkim.amazonses.com"] | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
output "identity_arn" { | ||
value = "${aws_ses_domain_identity.domain.arn}" | ||
} |