Don't assume WindowsServer is the only Windows offer, and short-circuit to true if 'is_windows_image' is supplied (#73)

This commit is contained in:
Xyon 2018-10-01 23:50:52 +01:00 коммит произвёл Su Shi
Родитель 0f20dbd054
Коммит ca710c6641
1 изменённых файлов: 4 добавлений и 4 удалений

Просмотреть файл

@ -36,7 +36,7 @@ resource "azurerm_storage_account" "vm-sa" {
}
resource "azurerm_virtual_machine" "vm-linux" {
count = "${!contains(list("${var.vm_os_simple}","${var.vm_os_offer}"), "WindowsServer") && var.is_windows_image != "true" && var.data_disk == "false" ? var.nb_instances : 0}"
count = "${!contains(list("${var.vm_os_simple}","${var.vm_os_offer}"), "Windows") && var.is_windows_image != "true" && var.data_disk == "false" ? var.nb_instances : 0}"
name = "${var.vm_hostname}${count.index}"
location = "${var.location}"
resource_group_name = "${azurerm_resource_group.vm.name}"
@ -84,7 +84,7 @@ resource "azurerm_virtual_machine" "vm-linux" {
}
resource "azurerm_virtual_machine" "vm-linux-with-datadisk" {
count = "${!contains(list("${var.vm_os_simple}","${var.vm_os_offer}"), "WindowsServer") && var.is_windows_image != "true" && var.data_disk == "true" ? var.nb_instances : 0}"
count = "${!contains(list("${var.vm_os_simple}","${var.vm_os_offer}"), "Windows") && var.is_windows_image != "true" && var.data_disk == "true" ? var.nb_instances : 0}"
name = "${var.vm_hostname}${count.index}"
location = "${var.location}"
resource_group_name = "${azurerm_resource_group.vm.name}"
@ -140,7 +140,7 @@ resource "azurerm_virtual_machine" "vm-linux-with-datadisk" {
}
resource "azurerm_virtual_machine" "vm-windows" {
count = "${(((var.vm_os_id != "" && var.is_windows_image == "true") || contains(list("${var.vm_os_simple}","${var.vm_os_offer}"), "WindowsServer")) && var.data_disk == "false") ? var.nb_instances : 0}"
count = "${((var.is_windows_image == "true" || contains(list("${var.vm_os_simple}","${var.vm_os_offer}"), "Windows")) && var.data_disk == "false") ? var.nb_instances : 0}"
name = "${var.vm_hostname}${count.index}"
location = "${var.location}"
resource_group_name = "${azurerm_resource_group.vm.name}"
@ -181,7 +181,7 @@ resource "azurerm_virtual_machine" "vm-windows" {
}
resource "azurerm_virtual_machine" "vm-windows-with-datadisk" {
count = "${((var.vm_os_id != "" && var.is_windows_image == "true") || contains(list("${var.vm_os_simple}","${var.vm_os_offer}"), "WindowsServer")) && var.data_disk == "true" ? var.nb_instances : 0}"
count = "${(var.is_windows_image == "true" || contains(list("${var.vm_os_simple}","${var.vm_os_offer}"), "Windows")) && var.data_disk == "true" ? var.nb_instances : 0}"
name = "${var.vm_hostname}${count.index}"
location = "${var.location}"
resource_group_name = "${azurerm_resource_group.vm.name}"