-
Notifications
You must be signed in to change notification settings - Fork 2
/
mail.tf
44 lines (38 loc) · 1.04 KB
/
mail.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
resource "aws_secretsmanager_secret" "crm-service" {
name = "crm-service"
}
resource "aws_secretsmanager_secret_version" "crm-service" {
secret_id = aws_secretsmanager_secret.crm-service.id
secret_string = jsonencode({
code = "change me"
dkim = "change me"
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" {
zone_id = local.kingdom.zone_id
name = ""
type = "TXT"
ttl = 172800
records = [local.mail-secret["code"]]
}
resource "aws_route53_record" "crm-dkim" {
zone_id = local.kingdom.zone_id
name = "mail._domainkey"
type = "TXT"
ttl = 172800
records = [local.mail-secret["dkim"]]
}
resource "aws_route53_record" "crm-dmarc" {
zone_id = local.kingdom.zone_id
name = "_dmarc"
type = "TXT"
ttl = 172800
records = [local.mail-secret["dmarc"]]
}