-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.tf
87 lines (69 loc) · 2.51 KB
/
main.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# MANAGE A CLOUDFLARE ZONE
# - manage zone settings
# - manage apple mail
# - manage google workspace
# - manage microsoft365
# - manage postmark
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
resource "cloudflare_zone" "this" {
account_id = var.account_id
zone = var.domain
plan = var.plan
jump_start = false
}
resource "cloudflare_zone_settings_override" "this" {
zone_id = cloudflare_zone.this.id
settings {
ssl = "strict"
always_use_https = "on"
opportunistic_encryption = "on"
tls_1_3 = "on"
automatic_https_rewrites = "on"
tls_client_auth = "on"
min_tls_version = "1.2"
security_level = var.settings_securitylevel
}
}
resource "cloudflare_zone_dnssec" "this" {
zone_id = cloudflare_zone.this.id
}
# ---------------------------------------------------------------------------------------------------------------------
# MAIL SETTINGS
# These optional modules manage mail settings for the zone.
# ---------------------------------------------------------------------------------------------------------------------
module "apple" {
source = "./modules/apple"
count = var.apple == null ? 0 : 1
zone_id = cloudflare_zone.this.id
verification = var.apple.verification
dkim_value = var.apple.dkim_value
dmarc_email = var.apple.dmarc_email
}
module "google" {
source = "./modules/google"
count = var.google == null ? 0 : 1
zone_id = cloudflare_zone.this.id
verification = var.google.verification
dkim_value = var.google.dkim_value
dmarc_email = var.google.dmarc_email
mta_sts_value = var.google.mta_sts_value
}
module "microsoft" {
source = "./modules/microsoft"
count = var.microsoft == null ? 0 : 1
zone_id = cloudflare_zone.this.id
verification = var.microsoft.verification
dmarc_email = var.microsoft.dmarc_email
mta_sts_value = var.microsoft.mta_sts_value
}
module "postmark" {
source = "./modules/postmark"
count = var.postmark == null ? 0 : 1
zone_id = cloudflare_zone.this.id
dmarc_email = var.postmark.dmarc_email
dkim_selector = var.postmark.dkim_selector
dkim_value = var.postmark.dkim_value
dkim_selector_staging = var.postmark.dkim_selector_staging
dkim_value_staging = var.postmark.dkim_value_staging
}