-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.tf
49 lines (41 loc) · 1.16 KB
/
main.tf
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
provider "azurerm" {
version = "~>2.0"
features {}
}
# Generate random password
resource "random_password" "password" {
length = 16
special = false
}
locals {
password = var.password != null ? var.password : random_password.password.result
}
// Create resource (if needed)
resource "azurerm_resource_group" "resource_group" {
count = var.create_resourcegroup ? 1 : 0
name = var.resourcegroup_name
location = var.location
}
// Create VNet
module "vnet" {
source = "./modules/vnet"
# Variables
resourcegroup_name = var.resourcegroup_name
location = var.location
depends_on = [
azurerm_resource_group.resource_group
]
}
// Loop over each student in students list and create VM(s)
module "vdi" {
source = "./modules/vdi"
# Variables
resourcegroup_name = var.resourcegroup_name
location = var.location
network_security_group_id = module.vnet.network_security_group_id
subnet_id = module.vnet.subnet_id
script_path = var.script_path
password = local.password
students = var.students
skip_extension = var.skip_extension
}