-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.bicep
87 lines (80 loc) · 1.88 KB
/
main.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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
@description('Location of the resources')
param location string = resourceGroup().location
@description('Name for vNet 1')
param vnet1Name string = 'vNet1'
@description('Name for vNet 2')
param vnet2Name string = 'vNet2'
var vnet1Config = {
addressSpacePrefix: '10.0.0.0/24'
subnetName: 'subnet1'
subnetPrefix: '10.0.0.0/24'
}
var vnet2Config = {
addressSpacePrefix: '192.168.0.0/24'
subnetName: 'subnet1'
subnetPrefix: '192.168.0.0/24'
}
resource vnet1 'Microsoft.Network/virtualNetworks@2020-05-01' = {
name: vnet1Name
location: location
properties: {
addressSpace: {
addressPrefixes: [
vnet1Config.addressSpacePrefix
]
}
subnets: [
{
name: vnet1Config.subnetName
properties: {
addressPrefix: vnet1Config.subnetPrefix
}
}
]
}
}
resource VnetPeering1 'Microsoft.Network/virtualNetworks/virtualNetworkPeerings@2020-05-01' = {
parent: vnet1
name: '${vnet1Name}-${vnet2Name}'
properties: {
allowVirtualNetworkAccess: true
allowForwardedTraffic: false
allowGatewayTransit: false
useRemoteGateways: false
remoteVirtualNetwork: {
id: vnet2.id
}
}
}
resource vnet2 'Microsoft.Network/virtualNetworks@2020-05-01' = {
name: vnet2Name
location: location
properties: {
addressSpace: {
addressPrefixes: [
vnet2Config.addressSpacePrefix
]
}
subnets: [
{
name: vnet2Config.subnetName
properties: {
addressPrefix: vnet2Config.subnetPrefix
}
}
]
}
}
resource vnetPeering2 'Microsoft.Network/virtualNetworks/virtualNetworkPeerings@2020-05-01' = {
parent: vnet2
name: '${vnet2Name}-${vnet1Name}'
properties: {
allowVirtualNetworkAccess: true
allowForwardedTraffic: false
allowGatewayTransit: false
useRemoteGateways: false
remoteVirtualNetwork: {
id: vnet1.id
}
}
}