-
Notifications
You must be signed in to change notification settings - Fork 0
/
08_virtual-machine.tf
37 lines (32 loc) · 981 Bytes
/
08_virtual-machine.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
resource "random_password" "password" {
length = 16
special = true
override_special = "_%@"
}
resource "azurerm_linux_virtual_machine" "example" {
name = var.virtalMachine
resource_group_name = azurerm_resource_group.myTerraformGroup.name
location = var.location
size = "Standard_F2"
admin_username = "adminuser"
admin_password = random_password.password.result
network_interface_ids = [
azurerm_network_interface.example.id,
]
admin_ssh_key {
username = "adminuser"
public_key = tls_private_key.ssh-key.public_key_openssh
}
os_disk {
caching = "ReadWrite"
storage_account_type = "Standard_LRS"
}
source_image_reference {
publisher = "Canonical"
offer = "UbuntuServer"
sku = "18.04-LTS"
version = "latest"
}
computer_name = var.virtalMachineName
disable_password_authentication = false
}