-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.bicep
232 lines (213 loc) · 6.37 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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
targetScope = 'subscription'
param parLocation string = 'westeurope'
param parVnet1Name string = 'az104-06-vnet01'
param parVnet2Name string = 'az104-06-vnet2'
param parVnet3Name string = 'az104-06-vnet3'
param parVnet1Address string = '10.60.0.0/22'
param parVnet2Address string = '10.62.0.0/22'
param parVnet3Address string = '10.63.0.0/22'
param parVm0Name string = 'az104-06-vm0'
param parVm0NicName string = 'az104-06-vm0-nic'
param parVm0NsgName string = 'az104-06-vm0-nsg'
param parVm1Name string = 'az104-06-vm1'
param parVm1NicName string = 'az104-06-vm1-nic'
param parVm1NsgName string = 'az104-06-vm1-nsg'
param parVm2Name string = 'az104-06-vm2'
param parVm2NicName string = 'az104-06-vm2-nic'
param parVm2NsgName string = 'az104-06-vm2-nsg'
param parVm3Name string = 'az104-06-vm3'
param parVm3NicName string = 'az104-06-vm3-nic'
param parVm3NsgName string = 'az104-06-vm3-nsg'
param parAdminUsername string = 'az104Admin'
@secure()
param parAdminPassword string
param parLoadBalancerName string = 'az104-06-lb4'
param parApplicationGatewayName string = 'az104-06-appgw5'
resource resRg1 'Microsoft.Resources/resourceGroups@2022-09-01' = {
name: 'az104-06-rg1'
location: parLocation
}
resource resRg2 'Microsoft.Resources/resourceGroups@2022-09-01' = {
name: 'az104-06-rg2'
location: parLocation
}
resource resRg3 'Microsoft.Resources/resourceGroups@2022-09-01' = {
name: 'az104-06-rg3'
location: parLocation
}
module modVnet1 './modules/network/vnet-hub.bicep' = {
name: 'vnet1'
scope: resRg1
params: {
parVnetName: parVnet1Name
parLocation: parLocation
parAddressPrefix: parVnet1Address
parSubnetNames: ['subnet0', 'subnet1', 'subnet-appgw']
parSubnetPrefixes: ['10.60.0.0/24', '10.60.1.0/24', '10.60.3.224/27']
}
}
module modVnet2 './modules/network/vnet-spoke.bicep' = {
name: 'vnet2'
scope: resRg2
params: {
parVnetName: parVnet2Name
parLocation: parLocation
parAddressPrefix: parVnet2Address
parSubnetName: 'subnet0'
parSubnetPrefix: '10.62.0.0/24'
parRouteTableId: modVnet2RouteTable.outputs.outRouteTableId
}
}
module modVnet3 './modules/network/vnet-spoke.bicep' = {
name: 'vnet3'
scope: resRg3
params: {
parVnetName: parVnet3Name
parLocation: parLocation
parAddressPrefix: parVnet3Address
parSubnetName: 'subnet0'
parSubnetPrefix: '10.63.0.0/24'
parRouteTableId: modVnet3RouteTable.outputs.outRouteTableId
}
}
module modPeer12 './modules/network/peering.bicep' = {
name: 'peer12'
scope: resRg1
params: {
parSourceVnetName: modVnet1.outputs.outVnetName
parDestinationVnetName: modVnet2.outputs.outVnetName
parDestinationVnetId: modVnet2.outputs.outVnetId
}
}
module modPeer21 './modules/network/peering.bicep' = {
name: 'peer21'
scope: resRg2
params: {
parSourceVnetName: modVnet2.outputs.outVnetName
parDestinationVnetName: modVnet1.outputs.outVnetName
parDestinationVnetId: modVnet1.outputs.outVnetId
}
}
module modPeer13 './modules/network/peering.bicep' = {
name: 'peer13'
scope: resRg1
params: {
parSourceVnetName: modVnet1.outputs.outVnetName
parDestinationVnetName: modVnet3.outputs.outVnetName
parDestinationVnetId: modVnet3.outputs.outVnetId
}
}
module modPeer31 './modules/network/peering.bicep' = {
name: 'peer31'
scope: resRg3
params: {
parSourceVnetName: modVnet3.outputs.outVnetName
parDestinationVnetName: modVnet1.outputs.outVnetName
parDestinationVnetId: modVnet1.outputs.outVnetId
}
}
module modVm0 './modules/compute/vm.bicep' = {
name: 'vm0'
scope: resRg1
params: {
parLocation: parLocation
parAdminUsername: parAdminUsername
parAdminPassword: parAdminPassword
parNicName: parVm0NicName
parNsgName: parVm0NsgName
parVirtualNetworkName: modVnet1.outputs.outVnetName
parSubnetName: 'subnet0'
parVmName: parVm0Name
parEnableIpForwarding: true
parLoadBalancerName: modPublicLoadBalancer.outputs.outLoadBalancerName
parLoadBalancerBackendPoolName: modPublicLoadBalancer.outputs.outLoadBalancerBackendPoolName
}
}
module modVm1 './modules/compute/vm.bicep' = {
name: 'vm1'
scope: resRg1
params: {
parLocation: parLocation
parAdminUsername: parAdminUsername
parAdminPassword: parAdminPassword
parNicName: parVm1NicName
parNsgName: parVm1NsgName
parVirtualNetworkName: modVnet1.outputs.outVnetName
parSubnetName: 'subnet1'
parVmName: parVm1Name
parLoadBalancerBackendPoolName: modPublicLoadBalancer.outputs.outLoadBalancerBackendPoolName
}
}
module modVm2 './modules/compute/vm.bicep' = {
name: 'vm2'
scope: resRg2
params: {
parLocation: parLocation
parAdminUsername: parAdminUsername
parAdminPassword: parAdminPassword
parNicName: parVm2NicName
parNsgName: parVm2NsgName
parVirtualNetworkName: modVnet2.outputs.outVnetName
parSubnetName: 'subnet0'
parVmName: parVm2Name
}
}
module modVm3 './modules/compute/vm.bicep' = {
name: 'vm3'
scope: resRg3
params: {
parLocation: parLocation
parAdminUsername: parAdminUsername
parAdminPassword: parAdminPassword
parNicName: parVm3NicName
parNsgName: parVm3NsgName
parVirtualNetworkName: modVnet3.outputs.outVnetName
parSubnetName: 'subnet0'
parVmName: parVm3Name
}
}
module modVnet2RouteTable './modules/network/route-table.bicep' = {
name: 'vm2RouteTable'
scope: resRg2
params: {
parRouteTableName: 'vm2RouteTable'
parLocation: parLocation
parRoute: {
name: 'routeVm2ToVm3'
addressPrefix: '10.63.0.0/16'
nextHopIpAddress: '10.60.0.4'
nextHopType: 'VirtualAppliance'
}
}
}
module modVnet3RouteTable './modules/network/route-table.bicep' = {
name: 'vm3RouteTable'
scope: resRg3
params: {
parRouteTableName: 'vm3RouteTable'
parLocation: parLocation
parRoute: {
name: 'routeVm3ToVm2'
addressPrefix: '10.62.0.0/16'
nextHopIpAddress: '10.60.0.4'
nextHopType: 'VirtualAppliance'
}
}
}
module modPublicLoadBalancer './modules/network/load-balancer.bicep' = {
name: 'publicLoadBalancer'
scope: resRg1
params: {
parLoadBalancerName: parLoadBalancerName
parLocation: parLocation
}
}
module modApplicationGateway './modules/network/application-gateway.bicep' = {
name: 'applicationGateway'
scope: resRg1
params: {
parApplicationGatewayName: parApplicationGatewayName
parLocation: parLocation
parVirtualNetworkName: modVnet1.outputs.outVnetName
}
}