Skip to content

Commit

Permalink
LRNT-020: Adding DNS validation records for Mail Service (#33)
Browse files Browse the repository at this point in the history
## πŸ‘¨πŸ½β€πŸ’» Description

These changes add the DNS records to validate Mail Service. This will
allow us to validate the domain names with the CRM Provider via
authentication from their side.

## βœ… Testing

- [x] Provisioned the infrastructure to development 
- [x] Confirm the records were created in Route53
- [x] Validation runs successful from the CRM Provider

## πŸ–ΌοΈ Evidence

Following screenshot shows the records created in AWS Route53:

![image](https://github.com/user-attachments/assets/0f869bc5-64fe-473e-8b22-8093fa3aa01f)

Following screenshot shows the successful authentication from the CRM
Provider:

![image](https://github.com/user-attachments/assets/c74edae9-b913-40db-864b-4f39b72d70aa)

---------

Signed-off-by: Ulises Tirado Zatarain <ulises.tirado@cimat.mx>
  • Loading branch information
zatarain authored Aug 9, 2024
1 parent 624ea57 commit e8c3018
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 e8c3018

Please sign in to comment.