我可以将 2 个 NIC 附加到 VM,但计划使用 terraform azure 将总共 4 个 NIC 添加到 linux VM

I could able to attach 2 NICS to the VM but Plan to add total 4 NICs to the linux VM using terraform azure

on .terraform\modules\fpm\main.tf line 27, in resource "azurerm_linux_virtual_machine" "main1":
  27:   network_interface_ids = [ "${var.nic1-id}", "${var.nic2-id}"]
    |----------------
    | var.nic1-id is tuple with 2 elements
    | var.nic2-id is tuple with 2 elements

Inappropriate value for attribute "network_interface_ids": element 0: string
required.

属性 network_interface_ids 需要网络接口 ID 列表,因此如果您通过变量输入所有 NIC ID,则可以将它们放入属性列表中,如下所示:

network_interface_ids = list(var.nic1-id, var.nic2-id)

但是如果两个变量是两个列表,则需要将它们合并为一个:

setunion(var.nic1-id, var.nic2-id)