Skip to content

Commit

Permalink
LRNT-020: Use empty string for the domain itself rather than '@'
Browse files Browse the repository at this point in the history
Signed-off-by: Ulises Tirado Zatarain <ulises.tirado@cimat.mx>
  • Loading branch information
zatarain committed Aug 9, 2024
1 parent c3ca131 commit a44a1f1
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions mail.tf
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,13 @@ data "aws_secretsmanager_secret_version" "crm-current" {
}

locals {
mail-server = terraform.workspace == "production" ? "" : trimsuffix(local.zone_prefix[terraform.workspace], ".zatara.in")
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 = local.mail-server == "" ? "@" : local.mail-server
name = ""
type = "TXT"
ttl = 172800
records = [local.mail-secret["code"]]
Expand All @@ -32,7 +31,7 @@ resource "aws_route53_record" "crm-code" {
resource "aws_route53_record" "crm-dkim" {
for_each = toset(local.configuration.sdlc.environments)
zone_id = local.kingdom.zone_id
name = "mail._domainkey.${local.mail-server}"
name = "mail._domainkey"
type = "TXT"
ttl = 172800
records = [local.mail-secret["dkim"]]
Expand All @@ -41,7 +40,7 @@ resource "aws_route53_record" "crm-dkim" {
resource "aws_route53_record" "crm-dmarc" {
for_each = toset(local.configuration.sdlc.environments)
zone_id = local.kingdom.zone_id
name = "_dmarc.${local.mail-server}"
name = "_dmarc"
type = "TXT"
ttl = 172800
records = [local.mail-secret["dmarc"]]
Expand Down

0 comments on commit a44a1f1

Please sign in to comment.