josenk / terraform-provider-esxi

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

Running example 8th, the VM network is not being set up. #214

Closed chunji08 closed 6 months ago

chunji08 commented 11 months ago

First of all, thanks for this project, that I can give a try on my vmware system !

I have tried the 08 example coming with the build, to try to see if I could have a VM created, along with the network setup. But somehow, the network part is missing. I can see the VM is created successfully, and I don't see any error either during the run-time.

here is the show details:


terraform show
# data.template_file.cloud-metadata:
data "template_file" "cloud-metadata" {
    id       = "a51b0c8b2b3599bfd791b7d4a60e23bcff77bb14e85abb04fb95b518e0d892ec"
    rendered = <<-EOT
        # network:
        #    version: 2
        #    ethernets:
        #         ens192:
        #            dhcp4: false
        #            addresses:
        #                - 10.10.10.1/24
        #            gateway4: 10.10.10.254
        #            nameservers:
        #                addresses:
        #                    - 8.8.8.8

        # example
        network:
             version: 2
             ethernets:
                 ens192:
                     dhcp4: false
                     addresses:
                         - 10.10.10.1/24
                     gateway4: 10.10.10.254
                     nameservers:
                         addresses:
                             - 8.8.8.8
    EOT
    template = <<-EOT
        # network:
        #    version: 2
        #    ethernets:
        #         ens192:
        #            dhcp4: false
        #            addresses:
        #                - ${ipAddress}
        #            gateway4: ${gateway}
        #            nameservers:
        #                addresses:
        #                    - ${nameserver}

        # example
        network:
             version: 2
             ethernets:
                 ens192:
                     dhcp4: false
                     addresses:
                         - 10.10.10.1/24
                     gateway4: 10.10.10.254
                     nameservers:
                         addresses:
                             - 8.8.8.8
    EOT
    vars     = {
        "gateway"    = "10.10.10.254"
        "ipAddress"  = "10.10.10.1/24"
        "nameserver" = "8.8.8.8"
    }
}

# esxi_guest.vmtest01:
resource "esxi_guest" "vmtest01" {
    boot_disk_type         = "thin"
    boot_firmware          = "bios"
    disk_store             = "6T-Local"
    guest_name             = "vmtest01"
    guest_shutdown_timeout = 20
    guest_startup_timeout  = 120
    guestinfo              = {
        "metadata"          = "H4sIAAAAAAAA/4yQXW6DMBCE332KkXguLRaVWt/GKtNSBQzyWiG5fcSPktj8KGu/2Du7M/oyOIah8yejMgA408t/5wz0/Gao6R2DLP2p6KT41s8/AKr6py8Nfm0jjDu2qjxFKMnEWG8oPvLlvusyFvzZwMFeS/MQ6c9E42xLoR9zb6w/sp7tv/LpKJWBF9v2DdWdCBIiSIisgGAXyF6qjUQxELwABLtAVuuPrCMgNwAAAP//AQAA//+QcINYGQIAAA=="
        "metadata.encoding" = "gzip+base64"
    }
    guestos                = "ubuntu-64"
    id                     = "105"
    memsize                = "8192"
    notes                  = "Ubuntu 20.04.2 VMware Image|0AUser Name: ubuntu|0APassword: ubuntu"
    numvcpus               = "16"
    ovf_properties_timer   = 90
    ovf_source             = "/home/chji/kube/images/Ubuntu_20.04.2_VM_LinuxVMImages.ovf"
    power                  = "on"
    resource_pool_name     = "/"
    virthwver              = "12"

    network_interfaces {
        nic_type        = "e1000"
        virtual_network = "VM Network"
    }
}

# esxi_portgroup.myportgroup:
resource "esxi_portgroup" "myportgroup" {
    id      = "My Port Group"
    name    = "My Port Group"
    vlan    = 0
    vswitch = "My vSwitch"
}

# esxi_vswitch.myvswitch:
resource "esxi_vswitch" "myvswitch" {
    forged_transmits    = false
    id                  = "My vSwitch"
    link_discovery_mode = "listen"
    mac_changes         = false
    mtu                 = 1500
    name                = "My vSwitch"
    ports               = 128
    promiscuous_mode    = false
}

Outputs:

ip = [
    "",
]

Thanks for the help.

Chun

josenk commented 7 months ago

Update this thread with the terraform apply output.

josenk commented 6 months ago

abandoned