-
Notifications
You must be signed in to change notification settings - Fork 19
/
vWanVpnConnections.bicep
73 lines (64 loc) · 1.88 KB
/
vWanVpnConnections.bicep
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
targetScope = 'subscription'
param location string
@secure()
param sharedKey string
param OnPremRgName string
param HubRgName string
param vwanLinkBgpAsn int
param vwanLinkBgpPeeringAddress string
param vwanLinkPublicIP string
param vwanVpnSiteName string
param vwanID string
param vwanHubName string
param vwanGatewayName string
param vwanVpnGwInfo array
param tagsByResource object = {}
param deployFirewallInHub bool
param OnPremVpnGwID string
// subscriptions
param hubSubscriptionID string
param onPremSubscriptionID string
// vWAN VPN Site and VPN Connection
resource hubrg 'Microsoft.Resources/resourceGroups@2023-07-01' existing = {
scope: subscription(hubSubscriptionID)
name: HubRgName
}
module vpnvWan 'modules/vwanvpnconnection.bicep' = {
scope: hubrg
name: 'vwanVPNsites'
params: {
linkBgpAsn: vwanLinkBgpAsn
linkBgpPeeringAddress: vwanLinkBgpPeeringAddress
linkPublicIP: vwanLinkPublicIP
location: location
vpnSiteName: vwanVpnSiteName
vwanGatewayName: vwanGatewayName
vwanHubName: vwanHubName
vwanID: vwanID
sharedKey: sharedKey
tagsByResource: tagsByResource
propagateToNoneRouteTable: deployFirewallInHub
}
}
// OnPrem VPN Local Gateway and Connection
resource onpremrg 'Microsoft.Resources/resourceGroups@2023-07-01' existing = {
scope: subscription(onPremSubscriptionID)
name: OnPremRgName
}
module vpnOnPrem 'modules/vpnconnection.bicep' = [for (item, i) in vwanVpnGwInfo: {
scope: onpremrg
name: 'vpnconnection${i + 1}'
params: {
connectionName: 'toVWAN${i + 1}'
enableBgp: true
LocalGatewayAddressPrefixes: []
LocalGatewayName: 'VWAN${i + 1}'
BgpPeeringAddress: vwanVpnGwInfo[i].defaultBgpIpAddresses[0]
BgpAsn: 65515
LocalGatewayPublicIP: vwanVpnGwInfo[i].tunnelIpAddresses[0]
location: location
sharedKey: sharedKey
VpnGatewayID: OnPremVpnGwID
tagsByResource: tagsByResource
}
}]