-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfrontdoor.tf
95 lines (86 loc) · 3.18 KB
/
frontdoor.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
88
89
90
91
92
93
94
95
resource "azurerm_frontdoor" "main" {
name = "${var.project}-${var.env}"
location = "global"
resource_group_name = azurerm_resource_group.main.name
enforce_backend_pools_certificate_name_check = true
friendly_name = "${var.project}-${var.env}"
frontend_endpoint {
name = "${var.project}-${var.env}-azurefd-net"
host_name = "${var.project}-${var.env}.azurefd.net"
custom_https_provisioning_enabled = false
}
dynamic "frontend_endpoint" {
iterator = host
for_each = var.frontend_with_disabled_waf_rules
content {
name = "${lookup(host.value, "name")}"
host_name = "${lookup(host.value, "name")}.${var.custom_domain_name}"
custom_https_provisioning_enabled = true
custom_https_configuration {
certificate_source = "FrontDoor"
}
}
}
dynamic "backend_pool_load_balancing" {
iterator = host
for_each = var.frontend_with_disabled_waf_rules
content {
name = "loadBalancingSettings-${lookup(host.value, "name")}"
sample_size = 4
successful_samples_required = 2
additional_latency_milliseconds = 0
}
}
dynamic "backend_pool_health_probe" {
iterator = host
for_each = var.frontend_with_disabled_waf_rules
content {
name = "healthProbeSettings-${lookup(host.value, "name")}"
interval_in_seconds = 30
path = "/"
protocol = "Https"
}
}
dynamic "backend_pool" {
iterator = host
for_each = var.frontend_with_disabled_waf_rules
content {
name = "${lookup(host.value, "name")}"
dynamic "backend" {
iterator = domain
for_each = var.backend_domain
content {
host_header = "${lookup(host.value, "name")}.${var.env}.${domain.value}"
address = "${lookup(host.value, "name")}.${var.env}.${domain.value}"
http_port = 80
https_port = 443
priority = 1
weight = 50
}
}
load_balancing_name = "loadBalancingSettings-${lookup(host.value, "name")}"
health_probe_name = "healthProbeSettings-${lookup(host.value, "name")}"
}
}
dynamic "routing_rule" {
iterator = host
for_each = var.frontend_with_disabled_waf_rules
content {
name = "${lookup(host.value, "name")}Rule"
accepted_protocols = ["Http", "Https"]
patterns_to_match = ["/*"]
frontend_endpoints = ["${lookup(host.value, "name")}"]
forwarding_configuration {
forwarding_protocol = "MatchRequest"
backend_pool_name = "${lookup(host.value, "name")}"
cache_query_parameter_strip_directive = "StripNone"
cache_use_dynamic_compression = false
custom_forwarding_path = ""
}
}
}
tags = "${var.common_tags}"
depends_on = [
azurerm_frontdoor_firewall_policy.custom
]
}