forked from HoussemDellai/azure-monitoring-course
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvm-linux.tf
More file actions
71 lines (60 loc) · 2.46 KB
/
Copy pathvm-linux.tf
File metadata and controls
71 lines (60 loc) · 2.46 KB
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
resource "azurerm_public_ip" "pip_vm_linux" {
name = "pip-vm-linux"
resource_group_name = azurerm_resource_group.rg.name
location = azurerm_resource_group.rg.location
allocation_method = "Static"
sku = "Standard"
}
resource "azurerm_network_interface" "nic_vm_linux" {
name = "nic-vm-linux"
resource_group_name = azurerm_resource_group.rg.name
location = azurerm_resource_group.rg.location
ip_configuration {
name = "internal"
subnet_id = azurerm_subnet.snet_vm.id
private_ip_address_allocation = "Dynamic"
public_ip_address_id = azurerm_public_ip.pip_vm_linux.id
}
}
resource "azurerm_linux_virtual_machine" "vm_linux" {
name = "vm-linux"
resource_group_name = azurerm_resource_group.rg.name
location = azurerm_resource_group.rg.location
size = "Standard_D2ads_v6"
disable_password_authentication = false
admin_username = "azureuser"
admin_password = "@Aa123456789"
network_interface_ids = [azurerm_network_interface.nic_vm_linux.id]
priority = "Spot"
eviction_policy = "Delete"
disk_controller_type = "NVMe" # "SCSI" # "IDE" # "SCSI" is the default value. "NVMe" is only supported for Ephemeral OS Disk.
custom_data = filebase64("./generate-logs.sh")
identity {
type = "SystemAssigned"
}
os_disk {
name = "os-disk-linux"
caching = "ReadOnly" # "ReadWrite" # None, ReadOnly and ReadWrite.
storage_account_type = "StandardSSD_LRS" # "Standard_LRS"
disk_size_gb = 64
diff_disk_settings {
option = "Local" # Specifies the Ephemeral Disk Settings for the OS Disk. At this time the only possible value is Local.
placement = "NvmeDisk" # "ResourceDisk" # "CacheDisk" # Specifies the Ephemeral Disk Placement for the OS Disk. NvmeDisk can only be used for v6 VMs
}
}
source_image_reference {
publisher = "canonical"
offer = "ubuntu-24_04-lts"
sku = "server"
version = "latest"
}
boot_diagnostics {
storage_account_uri = null
}
}
output "vm_linux_public_ip" {
value = azurerm_public_ip.pip_vm_linux.ip_address
}
output "vm_linux_private_ip" {
value = azurerm_network_interface.nic_vm_linux.private_ip_address
}