I’ve got VM code created in a module as per below but getting an error on plan that the argument is required - do I have to add a var for network_interface_ids in the vm_module and pass something through to it?
│
│ on windows_vm.tf line 1, in module “windows_vm”:
│ 1: module “windows_vm” {
│
│ The argument “network_interface_ids” is required, but no definition was found.
#in the windows_vm module:
#create nic with static/dynamic private IP address
resource “azurerm_network_interface” “vm_nic” {
name = “${var.vm_name}-nic”
location = var.location
resource_group_name = var.resource_group_name
accelerated_networking_enabled = var.accelerated_networking_enabled
ip_configuration {
name = “internal”
subnet_id = data.azurerm_subnet.subnet
private_ip_address_allocation = var.private_ip_address == null ? “Dynamic” : “Static”
private_ip_address = var.private_ip_address == null ? null : var.private_ip_address
}
}
resource “azurerm_windows_virtual_machine” “vm” {
name = var.vm_name
location = var.location
resource_group_name = var.resource_group_name
zone = var.availablity_zone
size = var.vm_size
network_interface_ids = [azurerm_network_interface.vm_nic.id]