-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.bicep
97 lines (76 loc) · 2.74 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
import * as sharpResource from '../lib/resource.bicep'
import * as sharpTag from '../lib/tag.bicep'
targetScope = 'subscription'
param environment sharpTag.env
@minLength(2)
@maxLength(5)
@description('Project short name. A unique identifier (2 to 5 characters) for a project')
param projectShortName string
@minLength(2)
@maxLength(7)
@description('Functional name for composing resource names. Only alphanumeric.')
param functionalName string
@minLength(3)
@maxLength(3)
param revision string
@description('Assign a role to a EntraID principal')
param principalId string
@description('CIDR, address space of a subnet')
param subnetAddressPrefix string
@description('CIDR, address space of a vnet')
param vnetAddressPrefix array
@description('Id of a Log Analytics workspace')
param workspaceId string = ''
param tagsDevOpsServices sharpTag.collectionDevOpsServices
param tagsServiceNow sharpTag.collectionServiceNow
param tagsEnterprise sharpTag.collectionEnterprise
var tags = union(
tagsDevOpsServices,
tagsServiceNow,
tagsEnterprise,
{
env: environment
}
)
var contentPostFix = '${projectShortName}-${functionalName}-${environment}-${revision}'
var sharpContentResourceGroup = sharpResource.buildResourceGroup(contentPostFix)
var sharpNetworkResourceGroup = sharpResource.buildResourceGroup('${contentPostFix}-infra')
resource vnetResourceGroup 'Microsoft.Resources/resourceGroups@2023-07-01' = {
name: sharpNetworkResourceGroup.name
properties: sharpNetworkResourceGroup.properties
location: sharpResource.getPrimaryLocation()
tags: tags
}
module network 'modules/vnet.bicep' = {
name: sharpResource.createModuleName(sharpNetworkResourceGroup.name, null)
scope: vnetResourceGroup
params: {
tags: tags
vnetPostFix: contentPostFix
vnetAddressPrefix: vnetAddressPrefix
subnetAddressPrefix: subnetAddressPrefix
subnetPostfix: contentPostFix
}
}
resource contentResourceGroup 'Microsoft.Resources/resourceGroups@2023-07-01' = {
name: sharpContentResourceGroup.name
properties: sharpContentResourceGroup.properties
location: sharpResource.getPrimaryLocation()
tags: tags
}
module storageAccount 'modules/storage-account.bicep' = {
name: sharpResource.createModuleName(sharpContentResourceGroup.name, null)
scope: contentResourceGroup
params: {
storagePostfix: contentPostFix
tags: tags
workspaceId: workspaceId
blobContainerName: '${projectShortName}-container'
principalId: principalId
subnetId: network.outputs.subnetId
}
}
output resourceGroupName string = contentResourceGroup.name
output storageAccountName string = storageAccount.outputs.name
output storageAccountBlobUrl string = storageAccount.outputs.blobEndpoint
output storageAccountDfsUrl string = storageAccount.outputs.dfsEndpoint