Skip to content

Commit

Permalink
Merge branch 'lrnt-020/email-server-setup' into staging
Browse files Browse the repository at this point in the history
  • Loading branch information
zatarain committed Aug 9, 2024
2 parents bcb6647 + a44a1f1 commit 5f3670c
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions mail.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,38 @@ resource "aws_secretsmanager_secret_version" "crm-service" {
dmarc = "change me"
})
}

data "aws_secretsmanager_secret_version" "crm-current" {
secret_id = aws_secretsmanager_secret.crm-service.id
}

locals {
mail-secret = jsondecode(data.aws_secretsmanager_secret_version.crm-current.secret_string)
}

resource "aws_route53_record" "crm-code" {
for_each = toset(local.configuration.sdlc.environments)
zone_id = local.kingdom.zone_id
name = ""
type = "TXT"
ttl = 172800
records = [local.mail-secret["code"]]
}

resource "aws_route53_record" "crm-dkim" {
for_each = toset(local.configuration.sdlc.environments)
zone_id = local.kingdom.zone_id
name = "mail._domainkey"
type = "TXT"
ttl = 172800
records = [local.mail-secret["dkim"]]
}

resource "aws_route53_record" "crm-dmarc" {
for_each = toset(local.configuration.sdlc.environments)
zone_id = local.kingdom.zone_id
name = "_dmarc"
type = "TXT"
ttl = 172800
records = [local.mail-secret["dmarc"]]
}

0 comments on commit 5f3670c

Please sign in to comment.