hashicorp / terraform-provider-vsphere

Terraform Provider for VMware vSphere
https://registry.terraform.io/providers/hashicorp/vsphere/
Mozilla Public License 2.0
612 stars 449 forks source link

vsphere provider doesn't complete when creating instance. #207

Closed lbrigman124 closed 6 years ago

lbrigman124 commented 6 years ago

terraform -v Terraform v0.10.7 uname -a Linux lbrigman-e32 2.6.32-696.3.2.el6.x86_64 #1 SMP Mon Jun 19 11:23:31 CDT 2017 x86_64 x86_64 x86_64 GNU/Linux

terraform providers . └── provider.vsphere find .terraform .terraform .terraform/plugins .terraform/plugins/linux_amd64 .terraform/plugins/linux_amd64/lock.json .terraform/plugins/linux_amd64/terraform-provider-vsphere_v0.4.2_x4

resource "vsphere_virtual_machine" "gsm1" {
    # this is the vsphere name
    name   = "gsm1.mdc.usaorbea.lab"
    hostname = "gsm1"
    vcpu   = 4
    memory = 16384
    domain = "mdc.usaorbea.lab"
    datacenter = "${var.vsphere_datacenter}"
    cluster = "${var.vsphere_cluster}"

    folder = "${vsphere_folder.openshift-cluster.path}"
    enable_disk_uuid = true
    # Define the Networking settings for the VM
    # no address should cause DHCP
    network_interface {
        label = "MDCDevelopment"
   }
   # Define the Disks and resources. The first disk should include the template.
    disk {
        template = "Centos7-base"
        datastore = "vSphere-Pure-01"
        type ="thin"
    }

    # second disk
    disk {
      size = 50
      type = "thin"
      datastore = "vSphere-Pure-01"
      name = "gsm1-disk2.vmdk"
    }

    # Define Time Zone
    time_zone = "America/Los_Angles"
}

Expected Behavior

Terraform should complete when the instance is created and configured.

Actual Behavior

Was 'Still creating...' after 8 minutes. vsphere_virtual_machine.gsm1: Still creating... (8m0s elapsed) ^CInterrupt received. Please wait for Terraform to exit or data loss may occur. Gracefully shutting down... stopping apply operation... vsphere_virtual_machine.gsm1: Still creating... (8m10s elapsed) vsphere_virtual_machine.gsm1: Still creating... (8m20s elapsed) vsphere_virtual_machine.gsm1: Still creating... (8m30s elapsed) vsphere_virtual_machine.gsm1: Still creating... (8m40s elapsed) vsphere_virtual_machine.gsm1: Still creating... (8m50s elapsed) vsphere_virtual_machine.gsm1: Still creating... (9m0s elapsed) vsphere_virtual_machine.gsm1: Still creating... (9m10s elapsed) vsphere_virtual_machine.gsm1: Still creating... (9m20s elapsed) vsphere_virtual_machine.gsm1: Still creating... (9m30s elapsed) vsphere_virtual_machine.gsm1: Still creating... (9m40s elapsed) vsphere_virtual_machine.gsm1: Still creating... (9m50s elapsed) vsphere_virtual_machine.gsm1: Still creating... (10m0s elapsed) vsphere_virtual_machine.gsm1: Still creating... (10m10s elapsed)

Apply complete! Resources: 0 added, 0 changed, 0 destroyed.

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. terraform apply

Important Factoids

Terraform 0.10.4 and provider v0.2.2_x4 worked but took almost double the actual instance creation time (1m:20s for terraform, watching Vsphere Center client - complete in about 20 seconds).

lbrigman124 commented 6 years ago

Just checked on something that may have caused the issue but I am not certain. The instance is using DHCP. We are also using Dynamic DNS and the hostname is not registered due to DHCP lease time-out issues.

vancluever commented 6 years ago

Hey @lbrigman124 thanks for submitting the issue and sorry you are having trouble!

From what it sounds like, you might be able to corroborate your findings by setting wait_for_guest_net to false. That will skip the network waiter, which would be causing timeouts if you were having issues getting a routeable address.

Let us know how it goes!

diwu1989 commented 6 years ago

i saw a behavior similar to this, will try out the wait_for_guest_net = false tweak and report back if it fixes my situation, thx!

msborrowersfirst commented 6 years ago

Hi!

We have a similar issue. We're using a static IP address, and have set _wait_for_guestnet = false without luck.

terraform-provider-vsphere_v0.4.2_x4

If you'd like a more verbose environment description then please let me know.

Thanks!

vancluever commented 6 years ago

Hey @msborrowersfirst, if you are having issues with this a log would definitely be helpful, or even at least your Terraform output and your configuration if you can share it. Thanks!

diwu1989 commented 6 years ago

wait_for_guest_net=false speeds up the creation process for my VMs

vancluever commented 6 years ago

To be clear on the value of wait_for_guest_net: we need to have guest networking available to report a valid address to any provisioners that have been set up on the resource. Further to this, namely on Windows problems can arise where an autoconfiguration IPv4 address shows up before the valid static IP addresses that have either been set up in the resource, or possibly a valid DHCP address, which is why we wait for an address that can reach the internet (by checking that it has a valid link-local gateway).

wait_for_guest_net=false allows you to skip this process, speeding up deploy time, but more than likely means your IP address information will be incomplete and you may run into issues when trying to use provisioners and what not. So keep that in mind when using the setting!

diwu1989 commented 6 years ago

Okay, do u mind if I submit a PR against the documentation for wait_for_guest_net to include some of this nuanced information? That would make it more obvious how this flag is supposed to be used/abused.

DustinChaloupka commented 6 years ago

Having similar problems using a static IP. Just setting wait_for_guest_net = false does not get around the problem:

Terraform Resource

resource "vsphere_virtual_machine" "machine" {
  count = "1"
  # If this is set to false, then the host to the connections needs set
  # wait_for_guest_net = false

  dns_servers = ["10.10.10.53"]

  name = "test.com"

  memory = "4096"
  vcpu = "2"

  disk {
    datastore = "some_datastore"
    template = "template0"
  }

  disk {
    datastore = "some_datastore"
    size = "20"
    name = "test"
  }

  network_interface {
    label = "VLAN"
    ipv4_address = "10.10.10.96"
    ipv4_gateway = "10.10.10.254"
    ipv4_prefix_length = "24"
  }

  connection {
    # This needs set if wait_for_guest_net is false
    # host = "10.10.10.96"
    user = "user"
    private_key = "${file("path/to/private/key")}"
    agent = false
  }

  provisioner "remote-exec" {
    inline = [
      "echo 'Connected!'"
    ]
  }
}

The reason the host needs set in the connection block I believe is because the provider does not find everything it needs (unsure where it sets this in the code).

If wait_for_guest_net = true then the resource will timeout waiting for a routeable IP. The machine does come up fine and does have a configured interface:

eth0      Link encap:Ethernet  HWaddr 00:50:56:ad:8e:04
          inet addr:10.10.10.96  Bcast:10.10.10.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:22545 errors:0 dropped:22 overruns:0 frame:0
          TX packets:14431 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:44165721 (44.1 MB)  TX bytes:1142266 (1.1 MB)

I did find some boot logs on the machine where it mentioned the full network configuration step had failed, but I wasn't able to find anything in logs to figure out why.

I also added some of my own logging in the code where it waits for the guest network, but all I found was that in the events that came in, the IP route config was empty:

2017-10-31T09:33:24.838-0500 [DEBUG] plugin.terraform-provider-vsphere_v0.4.2_x4: 2017/10/31 09:33:24 [INFO] <<< VAL: {[{{} %!s(*types.NetDnsConfigInfo=&{{} false test vsphere.local [10.10.10.53] [vsphere.local]}) %!s(*types.NetIpRouteConfigInfo=&{{} []}) [] %!s(*types.NetDhcpConfigInfo=<nil>)}]}
2017-10-31T09:33:24.838-0500 [DEBUG] plugin.terraform-provider-vsphere_v0.4.2_x4: 2017/10/31 09:33:24 [INFO] <<< GUEST STACK INFO: {DynamicData:{} DnsConfig:0xc421beeb40 IpRouteConfig:0xc4204a29c0 IpStackConfig:[] DhcpConfig:<nil>}
2017-10-31T09:33:24.838-0500 [DEBUG] plugin.terraform-provider-vsphere_v0.4.2_x4: 2017/10/31 09:33:24 [INFO] <<< IP ROUTE CONFIG: +&{{} []}

Though in the added logs, at least it is finding the assigned static IP address:

2017-10-31T09:33:24.838-0500 [DEBUG] plugin.terraform-provider-vsphere_v0.4.2_x4: 2017/10/31 09:33:24 [INFO] <<< VAL: {[{{} VLAN [10.10.10.96] 00:50:56:ad:8e:04 %!s(bool=true) %!s(int32=4000) %!s(*types.NetDnsConfigInfo=<nil>) %!s(*types.NetIpConfigInfo=&{{} [{{} 10.10.10.96 24  preferred <nil>}] <nil> <nil>}) <nil>}]}
2017-10-31T09:33:24.838-0500 [DEBUG] plugin.terraform-provider-vsphere_v0.4.2_x4: 2017/10/31 09:33:24 [INFO] <<< GUEST NIC INFO: {DynamicData:{} Network:VLAN IpAddress:[10.10.10.96] MacAddress:00:50:56:ad:8e:04 Connected:true DeviceConfigId:4000 DnsConfig:<nil> IpConfig:0xc420794ab0 NetBIOSConfig:<nil>}
2017-10-31T09:33:24.838-0500 [DEBUG] plugin.terraform-provider-vsphere_v0.4.2_x4: 2017/10/31 09:33:24 [INFO] <<< IP CONFIG: &{DynamicData:{} IpAddress:[{DynamicData:{} IpAddress:10.10.10.96 PrefixLength:24 Origin: State:preferred Lifetime:<nil>}] Dhcp:<nil> AutoConfigurationEnabled:<nil>}
2017-10-31T09:33:24.838-0500 [DEBUG] plugin.terraform-provider-vsphere_v0.4.2_x4: 2017/10/31 09:33:24 [INFO] <<< IP ADDRESS: {DynamicData:{} IpAddress:10.10.10.96 PrefixLength:24 Origin: State:preferred Lifetime:<nil>}
2017-10-31T09:33:24.838-0500 [DEBUG] plugin.terraform-provider-vsphere_v0.4.2_x4: 2017/10/31 09:33:24 [INFO] <<< IP: 10.10.10.96, V4GW: <nil>, V6GW: <nil>, MASK: ffffff00
2017-10-31T09:33:24.838-0500 [DEBUG] plugin.terraform-provider-vsphere_v0.4.2_x4: 2017/10/31 09:33:24 [INFO] <<< IP CONFIG: &{DynamicData:{} IpAddress:[{DynamicData:{} IpAddress:10.10.10.96 PrefixLength:24 Origin: State:preferred Lifetime:<nil>}] Dhcp:<nil> AutoConfigurationEnabled:<nil>}
2017-10-31T09:33:24.838-0500 [DEBUG] plugin.terraform-provider-vsphere_v0.4.2_x4: 2017/10/31 09:33:24 [INFO] <<< IP ADDRESS: {DynamicData:{} IpAddress:10.10.10.96 PrefixLength:24 Origin: State:preferred Lifetime:<nil>}
2017-10-31T09:33:24.838-0500 [DEBUG] plugin.terraform-provider-vsphere_v0.4.2_x4: 2017/10/31 09:33:24 [INFO] <<< IP: 10.10.10.96, V4GW: <nil>, V6GW: <nil>, MASK: ffffff00

There was already an issue created about the gateway ip not getting set, so wondering if that is the case here.

For the workaround using the wait_for_guest_net = false though, since the host does not get set by the provider, it explicitly needs given in the connection block. The other downside is that there appears to be an issue with the provider storing the ipv4_address so if you want to reference the the machine's IP address in a different resource (ie to create a DNS record), it will also need to be explicitly set there. For us this isn't too bad since we pass in the static IP address into a variable, but unsure how it affects non-static IP addresses getting assigned to machines.

vancluever commented 6 years ago

Hey @DustinChaloupka, what guest OS are you running this with?

If this is a Linux box, you can find the customization log at /var/log/vmware-imc/toolsDeployPkg.txt. You should hopefully be able to find the source of your issue there.

Thanks!

DustinChaloupka commented 6 years ago

@vancluever It is Linux that we are using. I've provided the logs of /var/log/vmware-imc/toolsDeployPkg.log below, which nothing in it looks suspect to me, but I'm also not entirely sure what I should be looking for.

/var/log/vmware-imc/toolsDeployPkg.log ``` ## Starting deploy pkg operation Deploying /tmp/vmware-root/3a6ef120/imcf-SosjUZ Initializing deployment module. Cleaning old state file from tmp directory. EXIT STATE INPROGRESS Setting deploy error: Error removing lock /tmp/.vmware-deploy.INPROGRESS (No such file or directory) EXIT STATE Done Setting deploy error: Error removing lock /tmp/.vmware-deploy.Done (No such file or directory) EXIT STATE ERRORED Setting deploy error: Error removing lock /tmp/.vmware-deploy.ERRORED (No such file or directory) Setting deploy error: Success. Deploying cabinet file /tmp/vmware-root/3a6ef120/imcf-SosjUZ. Transitioning from state (null) to state INPROGRESS. ENTER STATE INPROGRESS Reading cabinet file /tmp/vmware-root/3a6ef120/imcf-SosjUZ. Original deployment command: /usr/bin/perl -I/tmp/.vmware/linux/deploy/scripts /tmp/.vmware/linux/deploy/scripts/Customize.pl /tmp/.vmware/linux/deploy/cust.cfg Actual deployment command: /usr/bin/perl -I/tmp/.vmware-imgcust-dqRCcua/scripts /tmp/.vmware-imgcust-dqRCcua/scripts/Customize.pl /tmp/.vmware-imgcust-dqRCcua/cust.cfg Extracting package files. Command to exec : /usr/bin/perl sizeof ProcessInternal is 56 Returning, pending output from stdout Returning, pending output from stderr Saving output from stdout Saving output from stdout Saving output from stdout Saving output from stdout Saving output from stdout Saving output from stdout Process exited normally after 0 seconds, returned 0 Saving output from stdout Saving output from stdout Saving output from stdout Saving output from stdout Saving output from stdout No more output from stdout No more output from stderr Customization command output: INFO: Opening file name /tmp/.vmware-imgcust-dqRCcua/cust.cfg. DEBUG: Processing line: '[NETWORK]' DEBUG: FOUND CATEGORY = NETWORK DEBUG: Processing line: 'NETWORKING = yes' DEBUG: ADDED KEY-VAL :: 'NETWORK|NETWORKING' = 'yes' DEBUG: Processing line: 'BOOTPROTO = dhcp' DEBUG: ADDED KEY-VAL :: 'NETWORK|BOOTPROTO' = 'dhcp' DEBUG: Processing line: 'HOSTNAME = test' DEBUG: ADDED KEY-VAL :: 'NETWORK|HOSTNAME' = 'test' DEBUG: Processing line: 'DOMAINNAME = vsphere.local' DEBUG: ADDED KEY-VAL :: 'NETWORK|DOMAINNAME' = 'vsphere.local' DEBUG: Processing line: '' DEBUG: Empty line. Ignored. DEBUG: Processing line: '[NIC-CONFIG]' DEBUG: FOUND CATEGORY = NIC-CONFIG DEBUG: Processing line: 'NICS = NIC1' DEBUG: ADDED KEY-VAL :: 'NIC-CONFIG|NICS' = 'NIC1' DEBUG: Processing line: '' DEBUG: Empty line. Ignored. DEBUG: Processing line: '[NIC1]' DEBUG: FOUND CATEGORY = NIC1 DEBUG: Processing line: 'MACADDR = 00:50:56:ad:b2:b4' DEBUG: ADDED KEY-VAL :: 'NIC1|MACADDR' = '00:50:56:ad:b2:b4' DEBUG: Processing line: 'ONBOOT = yes' DEBUG: ADDED KEY-VAL :: 'NIC1|ONBOOT' = 'yes' DEBUG: Processing line: 'IPv4_MODE = BACKWARDS_COMPATIBLE' DEBUG: ADDED KEY-VAL :: 'NIC1|IPv4_MODE' = 'BACKWARDS_COMPATIBLE' DEBUG: Processing line: 'BOOTPROTO = static' DEBUG: ADDED KEY-VAL :: 'NIC1|BOOTPROTO' = 'static' DEBUG: Processing line: 'IPADDR = 10.10.10.96' DEBUG: ADDED KEY-VAL :: 'NIC1|IPADDR' = '10.10.10.96' DEBUG: Processing line: 'NETMASK = 255.255.255.0' DEBUG: ADDED KEY-VAL :: 'NIC1|NETMASK' = '255.255.255.0' DEBUG: Processing line: 'GATEWAY = 10.10.10.254' DEBUG: ADDED KEY-VAL :: 'NIC1|GATEWAY' = '10.10.10.254' DEBUG: Processing line: '' DEBUG: Empty line. Ignored. DEBUG: Processing line: '' DEBUG: Empty line. Ignored. DEBUG: Processing line: '[DNS]' DEBUG: FOUND CATEGORY = DNS DEBUG: Processing line: 'DNSFROMDHCP=no' DEBUG: ADDED KEY-VAL :: 'DNS|DNSFROMDHCP' = 'no' DEBUG: Processing line: 'SUFFIX|1 = vsphere.local' DEBUG: ADDED KEY-VAL :: 'DNS|SUFFIX|1' = 'vsphere.local' DEBUG: Processing line: 'NAMESERVER|1 = 10.10.10.53' DEBUG: ADDED KEY-VAL :: 'DNS|NAMESERVER|1' = '10.10.10.53' DEBUG: Processing line: 'NAMESERVER|2 = 10.10.10.25' DEBUG: ADDED KEY-VAL :: 'DNS|NAMESERVER|2' = '10.10.10.25' DEBUG: Processing line: 'NAMESERVER|3 = 172.172.172.41' DEBUG: ADDED KEY-VAL :: 'DNS|NAMESERVER|3' = '172.172.172.41' DEBUG: Processing line: '' DEBUG: Empty line. Ignored. DEBUG: Processing line: '[DATETIME]' DEBUG: FOUND CATEGORY = DATETIME DEBUG: Processing line: 'TIMEZONE = Etc/UTC' DEBUG: ADDED KEY-VAL :: 'DATETIME|TIMEZONE' = 'Etc/UTC' DEBUG: Processing line: 'UTC = yes' DEBUG: ADDED KEY-VAL :: 'DATETIME|UTC' = 'yes' DEBUG: Reading issue file ... DEBUG: Command: 'cat /etc/issue' DEBUG: Result: Ubuntu 14.04.5 LTS \n \l DEBUG: Exit Code: 0 DEBUG: Ubuntu 14.04.5 LTS \n \l DEBUG: Reading issue file ... DEBUG: Command: 'cat /etc/issue' DEBUG: Result: Ubuntu 14.04.5 LTS \n \l DEBUG: Exit Code: 0 DEBUG: Ubuntu 14.04.5 LTS \n \l DEBUG: Reading issue file ... DEBUG: Command: 'cat /etc/issue' DEBUG: Result: Ubuntu 14.04.5 LTS \n \l DEBUG: Exit Code: 0 DEBUG: Ubuntu 14.04.5 LTS \n \l WARNING: RedHat release file not available. Ignoring it. WARNING: Redhat flavor not detected DEBUG: Reading issue file ... DEBUG: Command: 'cat /etc/issue' DEBUG: Result: Ubuntu 14.04.5 LTS \n \l DEBUG: Exit Code: 0 DEBUG: Ubuntu 14.04.5 LTS \n \l WARNING: RedHat release file not available. Ignoring it. WARNING: Redhat flavor not detected DEBUG: Command: 'cat /etc/lsb-release' DEBUG: Result: DISTRIB_ID=Ubuntu DISTRIB_RELEASE=14.04 DISTRIB_CODENAME=trusty DISTRIB_DESCRIPTION="Ubuntu 14.04.5 LTS" DEBUG: Exit Code: 0 DEBUG: Command: 'cat /etc/issue' DEBUG: Result: Ubuntu 14.04.5 LTS \n \l DEBUG: Exit Code: 0 DEBUG: Reading issue file ... DEBUG: Command: 'cat /etc/issue' DEBUG: Result: Ubuntu 14.04.5 LTS \n \l DEBUG: Exit Code: 0 DEBUG: Ubuntu 14.04.5 LTS \n \l DEBUG: Command: 'cat /etc/lsb-release' DEBUG: Result: DISTRIB_ID=Ubuntu DISTRIB_RELEASE=14.04 DISTRIB_CODENAME=trusty DISTRIB_DESCRIPTION="Ubuntu 14.04.5 LTS" DEBUG: Exit Code: 0 DEBUG: Reading issue file ... DEBUG: Command: 'cat /etc/issue' DEBUG: Result: Ubuntu 14.04.5 LTS \n \l DEBUG: Exit Code: 0 DEBUG: Ubuntu 14.04.5 LTS \n \l INFO: Detected distribution: Ubuntu 14.04 DEBUG: Reading issue file ... DEBUG: Command: 'cat /etc/issue' DEBUG: Result: Ubuntu 14.04.5 LTS \n \l DEBUG: Exit Code: 0 DEBUG: Ubuntu 14.04.5 LTS \n \l INFO: Detected distribution flavour: Ubuntu 14.04 DEBUG: Command: 'hostname 2>/dev/null' DEBUG: Result: template DEBUG: Exit Code: 0 DEBUG: Command: 'hostname -f 2>/dev/null' DEBUG: Result: template DEBUG: Exit Code: 0 DEBUG: opening file /etc/hostname. DEBUG: Match found : Line = template DEBUG: Actual String : template INFO: OLD HOST NAME = template INFO: Marker file exists or is undefined, pre-customization is not needed INFO: Customizing Network settings ... INFO: Erasing DHCP leases DEBUG: Command: 'pkill dhclient' DEBUG: Result: DEBUG: Exit Code: 0 DEBUG: Command: 'rm -f /var/lib/dhcp/*' DEBUG: Result: DEBUG: Exit Code: 0 DEBUG: Host name is test DEBUG: opening file for writing (/etc/hostname). DEBUG: Command: 'chmod 644 /etc/hostname' DEBUG: Result: DEBUG: Exit Code: 0 INFO: Customizing NICS ... DEBUG: Command: 'modprobe pcnet32 2> /dev/null' DEBUG: Result: DEBUG: Exit Code: 0 DEBUG: Command: '/sbin/ifconfig eth0 2> /dev/null' DEBUG: Result: eth0 Link encap:Ethernet HWaddr 00:50:56:ad:b2:b4 UP BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B) DEBUG: Exit Code: 0 INFO: Customizing NICS. { NIC1 } INFO: Customizing NIC NIC1 DEBUG: Command: '/sbin/ifconfig -a' DEBUG: Result: eth0 Link encap:Ethernet HWaddr 00:50:56:ad:b2:b4 UP BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B) lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 UP LOOPBACK RUNNING MTU:65536 Metric:1 RX packets:128 errors:0 dropped:0 overruns:0 frame:0 TX packets:128 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1 RX bytes:10208 (10.2 KB) TX bytes:10208 (10.2 KB) DEBUG: Exit Code: 0 INFO: NIC suffix = eth0 INFO: No primary NIC defined. Adding all routes as default. INFO: Configuring ipv4 route (gateway settings) for eth0. INFO: Configuring default route 10.10.10.254 INFO: Query config for ^(NIC1\|IPv6ADDR\|) INFO: Query config for ^(NIC1\|IPv6NETMASK\|) INFO: Query config for ^(NIC1\|IPv6ADDR\|) INFO: Query config for ^(NIC1\|IPv6NETMASK\|) INFO: Query config for ^NIC1(\|IPv6GATEWAY\|) DEBUG: Command: 'mv /etc/network/interfaces /etc/network/interfaces.BeforeVMwareCustomization' DEBUG: Result: DEBUG: Exit Code: 0 DEBUG: opening file for writing (/etc/network/interfaces). INFO: Customizing Hosts file ... DEBUG: Old hostname=[template] DEBUG: Old FQDN=[template] DEBUG: New hostname=[test] DEBUG: New FQDN=[test.vsphere.local] DEBUG: opening file /etc/hosts. DEBUG: Line (inp): 127.0.0.1 localhost DEBUG: Line (inp): 127.0.1.1 template DEBUG: Replacing [template] DEBUG: Replacing [template] DEBUG: Adding [test.vsphere.local] DEBUG: Removing duplicating FQDNs DEBUG: Line (inp): DEBUG: Line (inp): # The following lines are desirable for IPv6 capable hosts DEBUG: Line (inp): ::1 localhost ip6-localhost ip6-loopback DEBUG: Line (inp): ff02::1 ip6-allnodes DEBUG: Line (inp): ff02::2 ip6-allrouters DEBUG: Static ip entry added DEBUG: Line (out): 127.0.0.1 localhost DEBUG: Line (out): 127.0.1.1 test.vsphere.local test DEBUG: Line (out): DEBUG: Line (out): # The following lines are desirable for IPv6 capable hosts DEBUG: Line (out): ::1 localhost ip6-localhost ip6-loopback DEBUG: Line (out): ff02::1 ip6-allnodes DEBUG: Line (out): ff02::2 ip6-allrouters DEBUG: Line (out): 10.10.10.96 test.vsphere.local test DEBUG: opening file for writing (/etc/hosts). DEBUG: Command: 'chmod 644 /etc/hosts' DEBUG: Result: DEBUG: Exit Code: 0 INFO: Customizing DNS ... DEBUG: opening file /etc/nsswitch.conf. DEBUG: opening file for writing (/etc/nsswitch.conf). DEBUG: Command: 'chmod 644 /etc/nsswitch.conf' DEBUG: Result: DEBUG: Exit Code: 0 DEBUG: opening file /etc/network/interfaces. INFO: Query config for ^(DNS\|SUFFIX\|) DEBUG: Match Found : DNS|SUFFIX|1 DEBUG: 0 INFO: Query config for ^(DNS\|NAMESERVER\|) DEBUG: Match Found : DNS|NAMESERVER|3 DEBUG: 0 DEBUG: Match Found : DNS|NAMESERVER|1 DEBUG: 1 DEBUG: Match Found : DNS|NAMESERVER|2 DEBUG: 2 DEBUG: opening file for writing (/etc/network/interfaces). INFO: Query config for ^(DNS\|SUFFIX\|) DEBUG: Match Found : DNS|SUFFIX|1 DEBUG: 0 DEBUG: opening file for writing (/etc/dhcp/dhclient.conf). DEBUG: Command: 'chmod 644 /etc/dhcp/dhclient.conf' DEBUG: Result: DEBUG: Exit Code: 0 INFO: Query config for ^(DNS\|NAMESERVER\|) DEBUG: Match Found : DNS|NAMESERVER|3 DEBUG: 0 DEBUG: Match Found : DNS|NAMESERVER|1 DEBUG: 1 DEBUG: Match Found : DNS|NAMESERVER|2 DEBUG: 2 DEBUG: opening file for writing (/etc/dhcp/dhclient.conf). DEBUG: Command: 'chmod 644 /etc/dhcp/dhclient.conf' DEBUG: Result: DEBUG: Exit Code: 0 INFO: Customizing Date&Time ... DEBUG: opening file /tmp/.vmware-imgcust-dqRCcua/scripts/tzdata/backward. DEBUG: Command: 'ln -sf /usr/share/zoneinfo/Etc/UTC /etc/localtime' DEBUG: Result: DEBUG: Exit Code: 0 DEBUG: opening file for writing (/etc/timezone). DEBUG: opening file for writing (/etc/default/rcS). DEBUG: Command: 'chmod 644 /etc/default/rcS' DEBUG: Result: DEBUG: Exit Code: 0 INFO: Marker file exists or is undefined, password settings are not needed INFO: Marker file exists or is undefined, post-customization is not needed INFO: Marker creation is not needed INFO: Customization completed. Transitioning from state INPROGRESS to state Done. ENTER STATE Done EXIT STATE INPROGRESS Deployment succeded. Wait before set enable-nics stats in vmx. Trying to connect network interfaces, attempt 1 Got VMX response 'queryNicsSupported' Got VMX response 'disconnected' Got VMX response 'connected' The network interfaces are connected on 1 second Launching cleanup. Command to exec : /bin/rm sizeof ProcessInternal is 56 Returning, pending output from stdout Returning, pending output from stderr Process exited normally after 0 seconds, returned 0 No more output from stdout No more output from stderr Customization command output: Ran DeployPkg_DeployPackageFromFile successfully ## Closing log ization is not needed INFO: Marker creation is not needed INFO: Customization completed. Transitioning from state INPROGRESS to state Done. ENTER STATE Done EXIT STATE INPROGRESS Deployment succeded. Wait before set enable-nics stats in vmx. Trying to connect network interfaces, attempt 1 Got VMX response 'queryNicsSupported' Got VMX response 'disconnected' Got VMX response 'connected' The network interfaces are connected on 1 second Launching cleanup. Command to exec : /bin/rm sizeof ProcessInternal is 56 Returning, pending output from stdout Returning, pending output from stderr Process exited normally after 0 seconds, returned 0 No more output from stdout No more output from stderr Customization command output: Rebooting Command to exec : /sbin/telinit sizeof ProcessInternal is 56 Returning, pending output from stdout Returning, pending output from stderr Process exited normally after 0 seconds, returned 0 No more output from stdout No more output from stderr Customization command output: Rebooting Command to exec : /sbin/telinit sizeof ProcessInternal is 56 Returning, pending output from stdout Returning, pending output from stderr Process exited normally after 0 seconds, returned 0 No more output from stdout No more output from stderr Customization command output: Rebooting Command to exec : /sbin/telinit sizeof ProcessInternal is 56 Returning, pending output from stdout Returning, pending output from stderr Process exited normally after 0 seconds, returned 0 No more output from stdout No more output from stderr Customization command output: Rebooting Command to exec : /sbin/telinit sizeof ProcessInternal is 56 Returning, pending output from stdout Returning, pending output from stderr Process exited normally after 0 seconds, returned 0 No more output from stdout No more output from stderr Customization command output: Rebooting Command to exec : /sbin/telinit sizeof ProcessInternal is 56 Returning, pending output from stdout Returning, pending output from stderr Process exited normally after 0 seconds, returned 0 No more output from stdout No more output from stderr Customization command output: Rebooting Command to exec : /sbin/telinit sizeof ProcessInternal is 56 Returning, pending output from stdout Returning, pending output from stderr Process exited normally after 0 seconds, returned 0 No more output from stdout No more output from stderr Customization command output: Rebooting Command to exec : /sbin/telinit sizeof ProcessInternal is 56 Returning, pending output from stdout Returning, pending output from stderr Process exited normally after 0 seconds, returned 0 No more output from stdout No more output from stderr Customization command output: Rebooting Command to exec : /sbin/telinit sizeof ProcessInternal is 56 Returning, pending output from stdout Returning, pending output from stderr Process exited normally after 0 seconds, returned 0 No more output from stdout No more output from stderr Customization command output: Rebooting Command to exec : /sbin/telinit sizeof ProcessInternal is 56 Returning, pending output from stdout Returning, pending output from stderr Process exited normally after 0 seconds, returned 0 No more output from stdout No more output from stderr Customization command output: Rebooting Command to exec : /sbin/telinit sizeof ProcessInternal is 56 Returning, pending output from stdout Returning, pending output from stderr Process exited normally after 0 seconds, returned 0 No more output from stdout No more output from stderr Customization command output: Rebooting Command to exec : /sbin/telinit sizeof ProcessInternal is 56 Returning, pending output from stdout Returning, pending output from stderr Process exited normally after 0 seconds, returned 0 No more output from stdout No more output from stderr Customization command output: Rebooting Command to exec : /sbin/telinit sizeof ProcessInternal is 56 Returning, pending output from stdout Returning, pending output from stderr ```
lynic commented 6 years ago

I have the same issue here, I use terraform v0.10.8 with vsphere provider v0.4.2 under macos. terraform apply hangs on "still creating". But I can see the IP address on vcenter and I can ssh to VM. There must some bug in finding the IP address of the VM in provider.

lynic commented 6 years ago

BTW setting wait_for_guest_net = false didn't work for me, it still hangs on "still creating" and then error with timeout.

vancluever commented 6 years ago

@lynic - have you tried setting `wait_for_customization_timeout to -1 well? This will disable all waiters.

kdunn-pivotal commented 6 years ago

I saw this issue when the template VM didn't already have VMWare Guest Tools installed and set to autostart.

vancluever commented 6 years ago

Hey all, #470 has now been merged which allows you to control the routable behaviour of the network waiter. Keep an eye out for 1.4.1 which will probably be out this week!