-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.tf
46 lines (37 loc) · 1.11 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
provider "azurerm" {
features {}
}
# Create Resource Groups
resource "azurerm_resource_group" "broadcaster-global_rg" {
name = "${var.name-prefix}-rg"
location = var.regions["1"].location
}
resource "azurerm_traffic_manager_profile" "tm_profile" {
name = var.name-prefix
resource_group_name = azurerm_resource_group.broadcaster-global_rg.name
traffic_routing_method = "Performance"
dns_config {
relative_name = var.name-prefix
ttl = 30
}
monitor_config {
protocol = "HTTP"
port = 80
path = "/"
expected_status_code_ranges = ["200-399"]
custom_header {
name = "host"
value = "global.broadcaster.stunner.cc"
}
}
}
resource "azurerm_traffic_manager_external_endpoint" "tm_endpoint" {
for_each = var.regions
name = "${var.name-prefix}-endpoint-${each.value.name}"
profile_id = azurerm_traffic_manager_profile.tm_profile.id
always_serve_enabled = false
priority = each.key
weight = 1
target = each.value.ip
endpoint_location = each.value.location
}