-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathckalabvms.tf
72 lines (59 loc) · 2.7 KB
/
ckalabvms.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
resource "azurerm_network_interface" "nic-ussc-ckalab" {
name = "vmusscckalab${count.index + 1}-NIC"
location = azurerm_resource_group.ckalab-ussc.location
resource_group_name = azurerm_resource_group.ckalab-ussc.name
#count = length(var.ussc-ckalab-ip_address)
count = length(local.settings.ckalab.ussc-ckalab-ip_address)
ip_configuration {
name = "ipconfig1"
subnet_id = azurerm_subnet.subnet-ussc-dev-fe.id
private_ip_address_allocation = "Static"
#private_ip_address = var.ussc-ckalab-ip_address[count.index]
private_ip_address = local.settings.ckalab.ussc-ckalab-ip_address[count.index]
}
tags = merge(local.settings.common_tags, local.settings.core_tags)
}
resource "azurerm_availability_set" "avset-ussc-ckalab" {
name = "vmusscckalab-avset"
location = azurerm_resource_group.ckalab-ussc.location
resource_group_name = azurerm_resource_group.ckalab-ussc.name
tags = merge(local.settings.common_tags, local.settings.core_tags)
}
resource "azurerm_virtual_machine" "vm-ussc-ckalab" {
name = "vmusscckalab${count.index + 1}"
location = azurerm_resource_group.ckalab-ussc.location
resource_group_name = azurerm_resource_group.ckalab-ussc.name
network_interface_ids = [element(azurerm_network_interface.nic-ussc-ckalab.*.id, count.index)]
vm_size = local.settings.ckalab.vm_size
availability_set_id = azurerm_availability_set.avset-ussc-ckalab.id
delete_data_disks_on_termination = true
count = length(local.settings.ckalab.ussc-ckalab-ip_address)
storage_image_reference {
publisher = local.settings.ckalab.publisher
offer = local.settings.ckalab.offer
sku = local.settings.ckalab.sku
version = local.settings.ckalab.version
}
os_profile {
computer_name = "vmusscckalab${count.index + 1}"
admin_username = local.settings.ckalab.admin_username
admin_password = azurerm_key_vault_secret.ussc-admin_ospassword.value
}
storage_os_disk {
name = "vmusscckalab${count.index + 1}-OSDisk"
create_option = "FromImage"
managed_disk_type = "Premium_LRS"
}
storage_data_disk {
name = "vmusscckalab${count.index + 1}-DataDisk01"
create_option = "Empty"
managed_disk_type = "Premium_LRS"
disk_size_gb = 64
lun = 0
caching = "None"
}
os_profile_linux_config {
disable_password_authentication = false
}
tags = merge(local.settings.common_tags, local.settings.core_tags)
}