-
Notifications
You must be signed in to change notification settings - Fork 478
Open
Labels
Milestone
Description
Code of Conduct
- I have read and agree to the Code of Conduct.
- Vote on this issue by adding a 👍 reaction to the original issue initial description to help the maintainers prioritize.
- Do not leave "+1" or other comments that do not add relevant information or questions.
- If you are interested in working on this issue or have submitted a pull request, please leave a comment.
Terraform
1.5.5
Terraform Provider
2.15.0
VMware vSphere
8.x
Description
We have configured a template OVF with 2 nics attached to 2 differnet portgroup and we tried to create a VM with 2 nics but we received this error after the apply command:
│ Error: 400 Bad Request: {"type":"com.vmware.vapi.std.errors.invalid_argument","value":{"error_type":"INVALID_ARGUMENT","messages":[{"args":["network_mappings","com.vmware.vcenter.ovf.library_item.resource_pool_deployment_spec"],"default_message":"Could not convert field 'network_mappings' of structure 'com.vmware.vcenter.ovf.library_item.resource_pool_deployment_spec'","id":"vapi.bindings.typeconverter.fromvalue.struct.field.error"},{"args":[],"default_message":"Element already present in the map.","id":"vapi.bindings.typeconverter.map.duplicate.element"}]}}
│
│ with vsphere_virtual_machine.backend_dc1[0],
│ on resources.tf line 78, in resource "vsphere_virtual_machine" "backend_dc1":
│ 78: resource "vsphere_virtual_machine" "backend_dc1" {
if we execute plan command we can notice different ports groups into the debug output.
Affected Resources or Data Sources
resource/vsphere_virtual_machine
Terraform Configuration
resource "vsphere_virtual_machine" "backend_dc1" {
count = var.vm_backend_dc1_nodes_count
name = "${var.vm_backend_dc1_hostname}${format("%02d", count.index + 1)}.${var.vm_domain}"
folder = var.vsphere_folder_name
num_cpus = var.vm_backend_dc1_cpus
memory = var.vm_backend_dc1_memory
firmware = var.vm_firmware
storage_policy_id = data.vsphere_storage_policy.cluster_datastore.id
resource_pool_id = data.vsphere_resource_pool.resource_pool.id
network_interface {
network_id = data.vsphere_network.dc1_network.id
adapter_type = var.vsphere_network_adapter_type
}
network_interface {
network_id = data.vsphere_network.dc1_internal_network.id
adapter_type = var.vsphere_network_adapter_type
}
disk {
label = "disk0"
size = var.vm_backend_dc1_disk_size
thin_provisioned = var.vm_disk_thin_provisioned
unit_number = 0
}
clone {
template_uuid = data.vsphere_content_library_item.content_library_template.id
customize {
linux_options {
host_name = "${var.vm_backend_dc1_hostname}${format("%02d", count.index + 1)}"
domain = var.vm_domain
}
network_interface {
ipv4_address = join("", element(data.dns_a_record_set.backend_dc1.*.addrs, count.index))
ipv4_netmask = var.vm_backend_dc1_ipv4_netmask
}
network_interface {
ipv4_address = join("", element(data.dns_a_record_set.internal_backend_dc1.*.addrs, count.index))
ipv4_netmask = var.vm_backend_dc1_ipv4_netmask
}
ipv4_gateway = var.vm_backend_dc1_ipv4_gateway
dns_suffix_list = var.vm_dns_suffix_list
dns_server_list = var.vm_dns_server_list
}
}
extra_config = {
"guestinfo.userdata" = base64gzip(local.cloud_init_templates_dc1[count.index])
"guestinfo.userdata.encoding" = "gzip+base64"
}
replace_trigger = base64gzip(local.cloud_init_templates_dc1[count.index])
tags = ["${data.vsphere_tag.terraform.id}"]
}
Debug Output
Terraform will perform the following actions:
# vsphere_virtual_machine.backend_dc1[0] will be created
+ resource "vsphere_virtual_machine" "backend_dc1" {
+ annotation = (known after apply)
+ boot_retry_delay = 10000
+ change_version = (known after apply)
+ cpu_limit = -1
+ cpu_share_count = (known after apply)
+ cpu_share_level = "normal"
+ datastore_id = (known after apply)
+ default_ip_address = (known after apply)
+ ept_rvi_mode = (known after apply)
+ extra_config = {
+ "guestinfo.userdata" = "xxxx"
+ "guestinfo.userdata.encoding" = "gzip+base64"
}
+ extra_config_reboot_required = true
+ firmware = "efi"
+ folder = "xxx"
+ force_power_off = true
+ guest_id = (known after apply)
+ guest_ip_addresses = (known after apply)
+ hardware_version = (known after apply)
+ host_system_id = (known after apply)
+ hv_mode = (known after apply)
+ id = (known after apply)
+ ide_controller_count = 2
+ imported = (known after apply)
+ latency_sensitivity = "normal"
+ memory = 4096
+ memory_limit = -1
+ memory_share_count = (known after apply)
+ memory_share_level = "normal"
+ migrate_wait_timeout = 30
+ moid = (known after apply)
+ name = "test-nics.test.local"
+ num_cores_per_socket = 1
+ num_cpus = 2
+ nvme_controller_count = 0
+ power_state = (known after apply)
+ poweron_timeout = 300
+ reboot_required = (known after apply)
+ replace_trigger = "xxxx"
+ resource_pool_id = "resgroup-xxxxxx"
+ run_tools_scripts_after_power_on = true
+ run_tools_scripts_after_resume = true
+ run_tools_scripts_before_guest_shutdown = true
+ run_tools_scripts_before_guest_standby = true
+ sata_controller_count = 0
+ scsi_bus_sharing = "noSharing"
+ scsi_controller_count = 1
+ scsi_type = "pvscsi"
+ shutdown_wait_timeout = 3
+ storage_policy_id = "xxxx"
+ swap_placement_policy = "inherit"
+ sync_time_with_host = true
+ tags = [
+ "urn:vmomi:InventoryServiceTag:xxx:GLOBAL",
]
+ tools_upgrade_policy = "manual"
+ uuid = (known after apply)
+ vapp_transport = (known after apply)
+ vmware_tools_status = (known after apply)
+ vmx_path = (known after apply)
+ wait_for_guest_ip_timeout = 0
+ wait_for_guest_net_routable = true
+ wait_for_guest_net_timeout = 5
+ clone {
+ template_uuid = "xxxxx"
+ timeout = 30
+ customize {
+ dns_server_list = [
+ "10.10.20.2",
+ "10.10.20.3",
]
+ dns_suffix_list = [
+ "test.local",
]
+ ipv4_gateway = "10.10.10.1"
+ timeout = 10
+ linux_options {
+ domain = "test.local"
+ host_name = "test-nics"
+ hw_clock_utc = true
}
+ network_interface {
+ ipv4_address = "10.10.10.10"
+ ipv4_netmask = 24
}
+ network_interface {
+ ipv4_address = "172.10.10.10"
+ ipv4_netmask = 24
}
}
}
+ disk {
+ attach = false
+ controller_type = "scsi"
+ datastore_id = "<computed>"
+ device_address = (known after apply)
+ disk_mode = "persistent"
+ disk_sharing = "sharingNone"
+ eagerly_scrub = false
+ io_limit = -1
+ io_reservation = 0
+ io_share_count = 0
+ io_share_level = "normal"
+ keep_on_remove = false
+ key = 0
+ label = "disk0"
+ path = (known after apply)
+ size = 64
+ storage_policy_id = (known after apply)
+ thin_provisioned = true
+ unit_number = 0
+ uuid = (known after apply)
+ write_through = false
}
+ network_interface {
+ adapter_type = "vmxnet3"
+ bandwidth_limit = -1
+ bandwidth_reservation = 0
+ bandwidth_share_count = (known after apply)
+ bandwidth_share_level = "normal"
+ device_address = (known after apply)
+ key = (known after apply)
+ mac_address = (known after apply)
+ network_id = "dvportgroup-12025xx"
}
+ network_interface {
+ adapter_type = "vmxnet3"
+ bandwidth_limit = -1
+ bandwidth_reservation = 0
+ bandwidth_share_count = (known after apply)
+ bandwidth_share_level = "normal"
+ device_address = (known after apply)
+ key = (known after apply)
+ mac_address = (known after apply)
+ network_id = "dvportgroup-11913xx"
}
}
Panic Output
No response
Expected Behavior
the creation finished with 2 nics
Actual Behavior
the creation fails
Steps to Reproduce
execute terraform apply.
Environment Details
No response
Screenshots
No response
References
georgeescott, EkilErif, TrustCoreUk, ItsSwixel, Sprucemagoo1 and 1 more