josenk / terraform-provider-esxi

Terraform-provider-esxi plugin
GNU General Public License v3.0
540 stars 154 forks source link

Network mapping for Multiple NIC OVA #142

Closed risyou closed 3 years ago

risyou commented 3 years ago

Describe the bug I have an ova that has two Networks with different names in its OVA, is there any way we can mapping a virtual network into it?

#terraform apply
...
╷
│ Error: There was an ovftool Error: Opening OVA source: ./centos-7.2009.10-202107041731.ova
│ The manifest validates
│ Opening VI target: vi://root@ves02.esxi.localhost//
│ Error: No network mapping specified. OVF networks:   OUTSIDE  REGULAR. Target networks:   c3560-vlan201-192-168-201-dhcp
│ Completed with errors
│ 
│ exit status 1
[shali@:01_OS_Images]$ovftool --hideEula centos-7.2009.10-202107041731.ova 
OVF version:   1.0
VirtualApp:    false
Name:          centos-7.2009.10-202107041731-single-nic

Download Size:  1.51 GB

Deployment Sizes:
  Flat disks:   40.00 GB
  Sparse disks: Unknown

Networks:
  Name:        OUTSIDE
  Description: Dedicated OUTSIDE network

  Name:        REGULAR
  Description: Optional REGULAR network

Virtual Machines:
  Name:               centos-7.2009.10-202107041731-single-nic
  Operating System:   centos64guest
  Virtual Hardware:
    Families:         vmx-11 
    Number of CPUs:   4
    Cores per socket: 1
    Memory:           16.00 GB

    Disks:
      Index:          0
      Instance ID:    9
      Capacity:       40.00 GB
      Disk Types:     SCSI-VirtualSCSI 

    NICs:
      Adapter Type:   VmxNet3
      Connection:     OUTSIDE

      Adapter Type:   VmxNet3
      Connection:     REGULAR

I was able to map one NIC OVA with the following. https://github.com/risyou/ves-esxi-terraform/blob/main/main.tf

josenk commented 3 years ago

Sorry, you cannot map nics in the ova. It's recommended to have 0 or 1 nic defined in your source images. ovftools has a hard time dealing with it. The plugin will create new network mappings based on the terraform settings you provide.