Skip to content

Commit 97dc8ac

Browse files
authored
Fixed deprecated list method (#168)
* Fixed deprecated list method In terraform >= 0.15.0, the deprecated list method is removed. This causes the module to stop working on newer versions. List method has been changed to tolist method. For more information see: - https://www.terraform.io/docs/language/functions/tolist.html - https://github.com/hashicorp/terraform/blob/v0.15/CHANGELOG.md#0150-april-14-2021 * Change BUILD_TERRAFORM_VERSION in Dockerfile to 0.14.4
1 parent 01fee36 commit 97dc8ac

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Pull the base image with given version.
2-
ARG BUILD_TERRAFORM_VERSION="0.13.5"
2+
ARG BUILD_TERRAFORM_VERSION="0.14.4"
33
FROM mcr.microsoft.com/terraform-test:${BUILD_TERRAFORM_VERSION}
44

55
ARG MODULE_NAME="terraform-azurerm-compute"

main.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ resource "azurerm_storage_account" "vm-sa" {
3030
}
3131

3232
resource "azurerm_virtual_machine" "vm-linux" {
33-
count = ! contains(list(var.vm_os_simple, var.vm_os_offer), "WindowsServer") && ! var.is_windows_image ? var.nb_instances : 0
33+
count = ! contains(tolist([var.vm_os_simple, var.vm_os_offer]), "WindowsServer") && ! var.is_windows_image ? var.nb_instances : 0
3434
name = "${var.vm_hostname}-vmLinux-${count.index}"
3535
resource_group_name = data.azurerm_resource_group.vm.name
3636
location = coalesce(var.location, data.azurerm_resource_group.vm.location)
@@ -139,7 +139,7 @@ resource "azurerm_virtual_machine" "vm-linux" {
139139
}
140140

141141
resource "azurerm_virtual_machine" "vm-windows" {
142-
count = (var.is_windows_image || contains(list(var.vm_os_simple, var.vm_os_offer), "WindowsServer")) ? var.nb_instances : 0
142+
count = (var.is_windows_image || contains(tolist([var.vm_os_simple, var.vm_os_offer]), "WindowsServer")) ? var.nb_instances : 0
143143
name = "${var.vm_hostname}-vmWindows-${count.index}"
144144
resource_group_name = data.azurerm_resource_group.vm.name
145145
location = coalesce(var.location, data.azurerm_resource_group.vm.location)
@@ -295,7 +295,7 @@ resource "azurerm_network_interface" "vm" {
295295
name = "${var.vm_hostname}-ip-${count.index}"
296296
subnet_id = var.vnet_subnet_id
297297
private_ip_address_allocation = "Dynamic"
298-
public_ip_address_id = length(azurerm_public_ip.vm.*.id) > 0 ? element(concat(azurerm_public_ip.vm.*.id, list("")), count.index) : ""
298+
public_ip_address_id = length(azurerm_public_ip.vm.*.id) > 0 ? element(concat(azurerm_public_ip.vm.*.id, tolist([""])), count.index) : ""
299299
}
300300

301301
tags = var.tags

0 commit comments

Comments
 (0)