Skip to content

Commit

Permalink
feat(add spf mta-sts smtp-tls): add spf mta-sts smtp-tls var configs (#1
Browse files Browse the repository at this point in the history
)
  • Loading branch information
jlison authored Aug 2, 2022
1 parent 728b887 commit 15714ab
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 4 deletions.
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,25 @@ terraform {
required_providers {
cloudflare = {
source = "cloudflare/cloudflare"
version = ">= 2.0"
version = "~> 3.0"
}
}
}
provider "cloudflare" {
email = var.cloudflare_email
api_token = var.cloudflare_token
}
module "email" {
source = "git@github.com:jlison/terraform-cloudflare-gsuite-mx.git"
source = "jlison/gsuite-mx/cloudflare"
version = "1.1.0"
zone_id = var.cloudflare_zone_id
sub_domain = "@" #optional
ttl = 3600 #optional
dkim = var.dkim # optional
dmarc = var.dmarc #optional
google_site_verification = var.google_site_verification #optional
mta_sts = var.mta_sts #optional
smtp_tls = var.smtp_tls #optional
}
```
20 changes: 19 additions & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ resource "cloudflare_record" "spf" {
zone_id = var.zone_id
name = var.sub_domain
type = "TXT"
value = "v=spf1 include:_spf.google.com ~all"
value = var.spf
ttl = var.ttl
}

Expand Down Expand Up @@ -49,3 +49,21 @@ resource "cloudflare_record" "google_site_verification" {
value = var.google_site_verification
ttl = var.ttl
}

resource "cloudflare_record" "mta_sts" {
count = length(var.mta_sts) > 0 ? 1 : 0
zone_id = var.zone_id
name = "_mta-sts"
type = "TXT"
value = var.mta_sts
ttl = var.ttl
}

resource "cloudflare_record" "smtp_tls" {
count = length(var.smtp_tls) > 0 ? 1 : 0
zone_id = var.zone_id
name = "_smtp._tls"
type = "TXT"
value = var.smtp_tls
ttl = var.ttl
}
18 changes: 18 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ variable "ttl" {
type = number
}

variable "spf" {
default = "v=spf1 include:_spf.google.com ~all"
description = "SPF record (optional)"
type = string
}

variable "dkim" {
default = ""
description = "DKIM key (optional)"
Expand All @@ -32,3 +38,15 @@ variable "google_site_verification" {
description = "Google site verification TXT record value (optional)"
type = string
}

variable "mta_sts" {
default = ""
description = "MTA-STS specification (optional)"
type = string
}

variable "smtp_tls" {
default = ""
description = "SMTP-TLS specification (optional)"
type = string
}

0 comments on commit 15714ab

Please sign in to comment.