vsphere virtual machine is not connected to/powered on after apply

825 views
Skip to first unread message

haai

unread,
May 24, 2017, 12:13:45 PM5/24/17
to Terraform
Hi all

Maybe I got something wrong but when I try to do the example from the terraform vmware vsphere example I got no running vm.
The VM is created but is powered off.

Does anyone know how to find out whats going on here? Does anyone have issues with vm creation? Do I miss something?

Settings:

ESXi 6.5 Hypervisor
vSphere 6.5 vCenter (Essentials Kit License)

$ terraform --version
Terraform v0.9.5

the terraform file

resource "vsphere_folder" "kube" {
  datacenter
= "Datacenter"
  path
= "kube"
}

resource
"vsphere_virtual_machine" "web" {
  name  
= "terraform-web"
  folder
= "${vsphere_folder.kube.path}"
  vcpu
= 2
  memory
= 2048
  domain
= example.foo
  datacenter
= "Datacenter"
  cdrom
{
    datastore
= "Images"
    path
= "CoreOS/coreos_production_iso_image.iso"
 
}
  network_interface
{
    label
= "VM Network"
 
}
  disk
{
    datastore
= "Local-SSD-(single-3g-sata)"
    name
= "web_disk"
    size
= 10
    type
= "thin"
 
}
}


terraform show output after apply
$ terraform show
vsphere_folder
.kube:
  id
= Datacenter/kube
  datacenter
= Datacenter
  existing_path
=
  path
= kube
vsphere_virtual_machine
.web:
  id
= kube/terraform-web
  cdrom
.# = 1
  cdrom
.0.datastore = Images
  cdrom
.0.path = CoreOS/coreos_production_iso_image.iso
  datacenter
= Datacenter
  detach_unknown_disks_on_delete
= false
  disk
.# = 1
  disk
.2565386792.bootable = false
  disk
.2565386792.controller_type = scsi
  disk
.2565386792.datastore = Local-SSD-(single-3g-sata)
  disk
.2565386792.iops = 0
  disk
.2565386792.keep_on_remove = false
  disk
.2565386792.key = 2000
  disk
.2565386792.name = web_disk
  disk
.2565386792.size = 10
  disk
.2565386792.template =
  disk
.2565386792.type = thin
  disk
.2565386792.uuid = 6000C292-9372-137d-f9f0-5366ab82fd98
  disk
.2565386792.vmdk =
  dns_servers
.# = 1
  dns_servers
.0 = 8.8.8.8
  domain
= example.foo
  enable_disk_uuid
= false
  folder
= kube
  linked_clone
= false
  memory
= 2048
  memory_reservation
= 0
  name
= terraform-web
  network_interface
.# = 0
  skip_customization
= false
  time_zone
= Etc/UTC
  uuid
= 42373f82-da52-accd-f127-3651fb4a9b73
  vcpu
= 2


Sean Boran

unread,
Jun 8, 2017, 4:09:51 AM6/8/17
to Terraform

Does your coreos image contain vmware tools?

I use a Vmware template and there is no reboot issue

Sean

Sean Boran

unread,
Jun 8, 2017, 4:31:36 AM6/8/17
to Terraform
P.S. I see you are able to put your VM into a folder. That does not work for me.
It creates the folder under the datacenter, but when creating the vm, complains:
  vsphere_virtual_machine.vm: Cannot find folder terraform
Do you have a tip for that?

Terraform v0.9.8

resource "vsphere_folder" "folder" {
  datacenter = "example"
  path       = "terraform"
}
resource "vsphere_virtual_machine" "vm" {
..
folder = "${vsphere_folder.folder.path}"

christian staffa

unread,
Jun 8, 2017, 8:08:55 AM6/8/17
to terrafo...@googlegroups.com
Well this is somewhat strange. When I use the above configuration (add a disc and a iso image) I cannot boot the vm.
It is just powered off and this is useless.

But I tried it with pxe booting.
I created a template with coreos_pxe image and I referenced this and disk template in terraform. Then the vm is able to come up after it has been cloned.
{{{
disk {
  datastore = "${var.datastore}"
  template = "coreos_ipxe"
}
}}}

but without template and a disk with size and name property and a cdrom image attached it does not work :(

After I managed to get it up and running with that, terraform stuck on continuously trying to wait for the vm to come up
{{{
vsphere_virtual_machine.torservice0: Still creating... (10s elapsed)
vsphere_virtual_machine.torservice0: Still creating... (20s elapsed)
vsphere_virtual_machine.torservice0: Still creating... (30s elapsed)
vsphere_virtual_machine.torservice0: Still creating... (40s elapsed)
vsphere_virtual_machine.torservice0: Still creating... (50s elapsed)
vsphere_virtual_machine.torservice0: Still creating... (1m0s elapsed)
vsphere_virtual_machine.torservice0: Still creating... (1m10s elapsed)
vsphere_virtual_machine.torservice0: Still creating... (1m20s elapsed)
vsphere_virtual_machine.torservice0: Still creating... (1m30s elapsed)
vsphere_virtual_machine.torservice0: Still creating... (1m40s elapsed)
vsphere_virtual_machine.torservice0: Still creating... (1m50s elapsed)
vsphere_virtual_machine.torservice0: Still creating... (2m0s elapsed)
vsphere_virtual_machine.torservice0: Still creating... (2m10s elapsed)
vsphere_virtual_machine.torservice0: Still creating... (2m20s elapsed)
vsphere_virtual_machine.torservice0: Still creating... (2m30s elapsed)
vsphere_virtual_machine.torservice0: Still creating... (2m40s elapsed)
vsphere_virtual_machine.torservice0: Still creating... (2m50s elapsed)
vsphere_virtual_machine.torservice0: Still creating... (3m0s elapsed)
vsphere_virtual_machine.torservice0: Still creating... (3m10s elapsed)
}}}

I get past it with launching the open-vm-tools docker image as a enabled service.

After starting this image terraform completes successfully having the right ip address etc. yaaay

But I have no issues creating the folder :(
Do you get an error or is it not visible at all without getting an error?

I am using
{{{
Version 6.5.0 Build 5318154
}}}
and
{{{
Terraform v0.9.5
}}}

Regards
   Chris

--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/hashicorp/terraform/issues
IRC: #terraform-tool on Freenode
---
You received this message because you are subscribed to a topic in the Google Groups "Terraform" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/terraform-tool/7dk7aX5O-Ew/unsubscribe.
To unsubscribe from this group and all its topics, send an email to terraform-tool+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/terraform-tool/7cc8f3ef-320a-4d16-886e-15631b457773%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages