-
Notifications
You must be signed in to change notification settings - Fork 2
/
lbe.bicep
90 lines (81 loc) · 2.76 KB
/
lbe.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
// Deploys the External Standard Load Balancer and associated public IP address
////////////////////////////////////////////////////////////////////////////////
// Required parameters
////////////////////////////////////////////////////////////////////////////////
param location string
////////////////////////////////////////////////////////////////////////////////
// Parameters with acceptable defaults
////////////////////////////////////////////////////////////////////////////////
param resourceNameFormat string = '{0}-syslogfwd-{1}'
@description('A value to indicate the deployment number.')
@minValue(0)
@maxValue(99)
param sequence int = 1
////////////////////////////////////////////////////////////////////////////////
// VARIABLES
////////////////////////////////////////////////////////////////////////////////
var sequenceFormatted = format('{0:00}', sequence)
var lbName = format(resourceNameFormat, 'lbe', sequenceFormatted)
var frontendName = 'syslog-external-frontend'
var backendName = 'syslogfwd-backend'
////////////////////////////////////////////////////////////////////////////////
// RESOURCES
////////////////////////////////////////////////////////////////////////////////
resource publicIP 'Microsoft.Network/publicIPAddresses@2021-02-01' = {
name: format(resourceNameFormat, 'pip', sequenceFormatted)
location: location
sku: {
name: 'Standard'
tier: 'Regional'
}
properties: {
publicIPAddressVersion: 'IPv4'
publicIPAllocationMethod: 'Static'
}
}
resource loadBalancer 'Microsoft.Network/loadBalancers@2021-02-01' = {
name: lbName
location: location
sku: {
name: 'Standard'
tier: 'Regional'
}
properties: {
frontendIPConfigurations: [
{
name: frontendName
properties: {
publicIPAddress: {
id: publicIP.id
}
}
}
]
backendAddressPools: [
{
name: backendName
}
]
outboundRules: [
{
name: 'syslogfwd-out'
properties: {
backendAddressPool: {
id: resourceId('Microsoft.Network/loadBalancers/backendAddressPools', lbName, backendName)
}
protocol: 'All'
frontendIPConfigurations: [
{
id: resourceId('Microsoft.Network/loadBalancers/frontendIPConfigurations', lbName, frontendName)
}
]
}
}
]
}
}
////////////////////////////////////////////////////////////////////////////////
// OUTPUTS
////////////////////////////////////////////////////////////////////////////////
output backendAddressPoolId string = loadBalancer.properties.backendAddressPools[0].id
output publicIP string = publicIP.properties.ipAddress