-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.tf
45 lines (42 loc) · 1.34 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
# This Terraform configuration defines resources and a module for deploying an Azure Virtual WAN setup.
resource "azurerm_resource_group" "this" {
name = var.resource_group.name
location = var.resource_group.location
tags = merge(
try(var.tags),
tomap({
"Resource Type" = "Resource Group"
})
)
}
resource "azurerm_virtual_wan" "this" {
name = var.virtual_wan.name
resource_group_name = azurerm_resource_group.this.name
location = coalesce(var.virtual_wan.location, azurerm_resource_group.this.location)
tags = merge(
try(var.tags),
tomap({
"Resource Type" = "Virtual WAN"
})
)
}
module "vhub" {
for_each = var.virtual_hubs
source = "./modules/vhub"
virtual_hubs = var.virtual_hubs[each.key]
virtual_wan_id = azurerm_virtual_wan.this.id
resource_group_name = azurerm_resource_group.this.name
tags = merge(
try(var.tags),
tomap({
})
)
}
resource "azurerm_virtual_hub_bgp_connection" "this" {
for_each = var.hub_bgp_peers
virtual_hub_id = each.value.virtual_hub_id
name = each.value.name
peer_asn = each.value.peer_asn
peer_ip = each.value.peer_ip
virtual_network_connection_id = each.value.vnet_connection_id
}