Skip to content
This repository has been archived by the owner on Jun 19, 2021. It is now read-only.

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
kostyaplis committed Dec 3, 2019
0 parents commit 02e79de
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 0 deletions.
36 changes: 36 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# SES domian verification
resource "aws_ses_domain_identity" "this" {
domain = var.domain_name
}

resource "aws_ses_domain_identity_verification" "this" {
depends_on = [aws_route53_record.ses_verification]
domain = aws_ses_domain_identity.this.id
}

resource "aws_route53_record" "ses_verification" {
zone_id = var.route53_zone_id
name = "_amazonses.${aws_ses_domain_identity.this.id}"
type = "TXT"
ttl = "60"
records = [aws_ses_domain_identity.this.verification_token]
}

# SES DKIM verification

resource "aws_ses_domain_dkim" "this" {
domain = aws_ses_domain_identity.this.domain
}

resource "aws_route53_record" "dkim" {
count = 3
zone_id = var.route53_zone_id
name = format(
"%s._domainkey.%s",
element(aws_ses_domain_dkim.main.dkim_tokens, count.index),
var.domain_name,
)
type = "CNAME"
ttl = "600"
records = ["${element(aws_ses_domain_dkim.main.dkim_tokens, count.index)}.dkim.amazonses.com"]
}
4 changes: 4 additions & 0 deletions outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
output "ses_identity_arn" {
description = "SES identity ARN"
value = aws_ses_domain_identity.this.arn
}
9 changes: 9 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
variable "domain_name" {
type = string
description = "The domain name for the SES account"
}

variable "route53_zone_id" {
type = string
description = "Route53 hosted zone ID to add verification records into"
}

0 comments on commit 02e79de

Please sign in to comment.