-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.tf
36 lines (32 loc) · 1.22 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
locals {
ssh_key_auth = var.vm_auth_method == "ssh_key" ? { dummy_create = true } : {}
}
resource "azurerm_linux_virtual_machine" "az_vm_linux" {
name = var.name
computer_name = var.computer_name == "" ? var.name : var.computer_name
resource_group_name = var.resource_group_name
location = var.location
size = var.vm_size
admin_username = var.admin_username
admin_password = var.vm_auth_method == "password" ? var.admin_password : null
network_interface_ids = var.network_interface_ids
disable_password_authentication = var.vm_auth_method == "password" ? false : true
tags = var.tags
dynamic "admin_ssh_key" {
for_each = local.ssh_key_auth
content {
username = var.admin_username
public_key = file(var.public_key_path)
}
}
os_disk {
caching = var.os_disk_caching
storage_account_type = var.os_disk_storage_account_type
}
source_image_reference {
publisher = var.image_publisher
offer = var.image_offer
sku = var.image_sku
version = var.image_version
}
}