Terraform: vsphere_virtual_machine with chef provisioner fails to connect with IPv6 address

Created on 11 May 2016  ยท  3Comments  ยท  Source: hashicorp/terraform

Hi,

I am trying to use Terraform to provision a VM from a template in my organization's vSphere instance. While Terraform is able to create a folder, deploy from a template, and boot up the VM properly, the Chef provisioner fails to connect to the VM. The problem seems to be that vsphere_virtual_machine receives the IPv6 IP address for the VM and sends that IP to the Chef provisioner. Chef then fails to make a connection using the IPv6 address, regardless of whether I use SSH or WinRM as the connection type, because it gets confused by too many colons.

In vSphere, when I watch the VM get set up, I see it display an IPv6 address first in the Summary tab, and then switch to an IPv4 address a short time later. Is it possible to tell vsphere_virtual_machine which IP address to send to the provisioner?

I've seen some issues related to vSphere and waiting for all IP address, as well as some IPv6 support being added, but I'm unsure if this is related to any of those issues.

Terraform Version

v0.6.16

Affected Resource(s)

Not entirely sure of the culprit, but could be any of these resources:

  • vsphere_virtual_machine
  • chef
  • connection

Terraform Configuration Files

# Create a virtual machine within the folder
resource "vsphere_virtual_machine" "web" {
    name = "terraform-web"
    folder = "${vsphere_folder.web.path}"
    datacenter = "DEVESX"
    vcpu = 4
    memory = 8192
    cluster = "General"

    network_interface {
        label = "dvPortGroup_8HourLease"
    }

    disk {
        template = "SCP Testing/templates/CP - packer-virtualbox-iso-1462307446"
        datastore = "/DEVESX/datastore/VM Datastores/Nobackup"
    }

    provisioner "chef" {
        attributes_json = <<EOF
        {
            "java": {
                "install_flavor": "windows",
                "windows": {
                    "package_name": "Java(TM) SE Development Kit 8 (64-bit)"
                },
                "jdk_version": "8",
                "oracle": {
                    "accept_oracle_download_terms": true
                }
            },
            "tomcat-all": {
                "version": "8.0.23"
            }
        }
        EOF
        run_list = ["java", "tomcat-all"]
        node_name = "terraform-vsphere"
        os_type = "windows"
        secret_key = "${file("H:/Chef/user.pem")}"
        server_url = "https://chef01.rds.company.com/"
        validation_client_name = "chef-validator"
        validation_key = "${file("H:/Chef/chef-validator.pem")}"
        version = "11.18.12"

        connection {
            type = "ssh"
            user = "Administrator"
            password = "${var.admin_password}"
        }
    }
}

Debug Output

Output

Panic Output

N/A

Expected Behavior

The Chef provisioner should be able to connect to the deployed vSphere virtual machine. Preference for IPv4 address.

Actual Behavior

The Chef provisioner fails to connect to the deployed vSphere virtual machine using IPv6 address.

Steps to Reproduce

  1. terraform apply

    Important Factoids

  • Trying to deploy from a Windows 2012 R2 template, built in Packer using packer-windows as the base.
  • Template has both WinRM and SSH installed and enabled (as used by Packer)

    References

bug providevsphere

All 3 comments

This PR should fix this issue. https://github.com/hashicorp/terraform/pull/6616

Closing now that the PR has been merged.

I'm going to lock this issue because it has been closed for _30 days_ โณ. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jeroenjacobs79 picture jeroenjacobs79  ยท  3Comments

carl-youngblood picture carl-youngblood  ยท  3Comments

rjinski picture rjinski  ยท  3Comments

rjinski picture rjinski  ยท  3Comments

c4milo picture c4milo  ยท  3Comments