Azure-Terraform / terraform-azurerm-virtual-machine

Terraform Virtual Machine Module
MIT License
8 stars 27 forks source link

public_ip_enabled variable no longer correctly calculating #25

Open moorma01 opened 1 year ago

moorma01 commented 1 year ago

Azure-Terraform/terraform-azurerm-virtual-machine?ref=v3.0.1

When setting public_ip_enabled to false or letting it default (false) Terraform Plans fail with the error below:

│ Error: parsing Azure ID: parse "": empty url │ │ with module.vms["match-host-01"].azurerm_network_interface.dynamic, │ on .terraform/modules/vms/main.tf line 60, in resource "azurerm_network_interface" "dynamic": │ 60: public_ip_address_id = var.public_ip_enabled ? azurerm_public_ip.primary[0].id : "" │

When setting the public_ip_eanbled variable to true the new infrastructure is planned successfully.

Instead of an empty string should we be passing in null? for azurerm_public_ip?

baolongkms commented 1 year ago

I have the same issues when I provision a VM using this module

moorma01 commented 1 year ago

@baolongkms, I believe this VM repository has been abandoned by whoever was maintaining it.

I forked off of this one and changed line 60 in main.tf to pass a null value instead of an empty string. public_ip_address_id = var.public_ip_enabled ? azurerm_public_ip.primary[0].id : null

wcarty commented 2 days ago

I implemented a fix for this in v3.0.2