-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.bicep
46 lines (37 loc) · 1.32 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
targetScope = 'subscription'
@allowed([
'eastus2'
'eastus'
])
param location string
@allowed([
'test'
'demo'
'prod'
])
param environment string
param workloadName string
// Optional parameters
param tags object = {}
param sequence int = 1
param namingConvention string = '{rtype}-{workloadName}-{env}-{loc}-{seq}'
param deploymentTime string = utcNow()
// Variables
var sequenceFormatted = format('{0:00}', sequence)
var deploymentNameStructure = '${workloadName}-${environment}-{rtype}-${deploymentTime}'
// Naming structure only needs the resource type ({rtype}) replaced
var namingStructure = replace(replace(replace(replace(namingConvention, '{env}', environment), '{loc}', location), '{seq}', sequenceFormatted), '{workloadName}', workloadName)
resource workloadResourceGroup 'Microsoft.Resources/resourceGroups@2021-04-01' = {
name: replace(namingStructure, '{rtype}', 'rg')
location: location
tags: tags
}
module roles 'common-modules/roles.bicep' = {
name: take(replace(deploymentNameStructure, '{rtype}', 'roles'), 64)
}
module abbreviations 'common-modules/abbreviations.bicep' = {
name: take(replace(deploymentNameStructure, '{rtype}', 'abbrev'), 64)
scope: workloadResourceGroup
}
// TODO: Add your deployments here
output namingStructure string = namingStructure