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.
v0.6.16
Not entirely sure of the culprit, but could be any of these resources:
# 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}"
}
}
}
N/A
The Chef provisioner should be able to connect to the deployed vSphere virtual machine. Preference for IPv4 address.
The Chef provisioner fails to connect to the deployed vSphere virtual machine using IPv6 address.
terraform apply
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.