-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.bicep
80 lines (69 loc) · 2.66 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
targetScope = 'subscription'
param location string = 'westeurope'
// Required configuration parameters
@description('Name of the resource group where the CycleCloud server instance would be deployed')
param resourceGroupName string
@description('CycleCloud requirements suggest a Virtual Machine with minimum 4vCPUs and 8GB RAM')
param vmSize string = 'Standard_D4s_v5'
@description('Name of an existing Virtual Network where CycleCloud server instance would be deployed ')
param vnetName string
@description('Name of the existing subnet inside the Virtual Network where CyecleCloud server instance would be deployed ')
param subnetName string
@description('Name of the resource group where the virtual network is provisioned. It not provided, the same resource group where the VM is being deployed is considered')
param vnetResourceGroupName string = resourceGroupName
@description('Name of the existing storage account used by CycleCloud as locker')
param storageAccountName string
param tenantId string
@secure()
@description('Password configured for both the user root of the VM, and administrator of CycleCloud installation')
param adminPassword string
@description('User name configured both as root of the VM, and administrator of CycleCloud installation')
param adminUsername string
@description('SSH Publick Key associated with the administrator user of CycleCloud installation ')
param publicKey string
// Optional deployment customizations
param ccVmName string = 'ccVm'
param ccVmPublicIpName string = 'ccVmPublicIp'
param ccVmNicName string = 'ccVmNic'
param ccComputerName string = 'ccserver'
param ccmVmCustomScriptName string = 'ccmVmCustomScript'
module ccVM 'cyclecloud.vm.bicep' = {
name: ccVmName
scope: resourceGroup(resourceGroupName)
params: {
location: location
adminPassword: adminPassword
adminUsername: adminUsername
subnetName: subnetName
vnetName: vnetName
vmSize: vmSize
ccComputerName: ccComputerName
ccVmName: ccVmName
ccVmPublicIpName: ccVmPublicIpName
ccVmNicName: ccVmNicName
vnetResourceGroupName: vnetResourceGroupName
}
}
module ccManagedIdentity 'cyclecloud.managedIdentity.bicep' = {
name: guid('ccVmMiRoleAssignment')
params: {
principalId: ccVM.outputs.principalId
}
}
module ccVmCustomScript 'cyclecloud.vm.extension.bicep' = {
name: ccmVmCustomScriptName
scope: resourceGroup(resourceGroupName)
dependsOn: [
ccManagedIdentity
]
params: {
adminPassword: adminPassword
adminUsername: adminUsername
location: location
publicKey: publicKey
storageAccountName: storageAccountName
tenantId: tenantId
ccmVmCustomScriptName: ccmVmCustomScriptName
ccVmName: ccVmName
}
}