GithubHelp home page GithubHelp logo

terraform-provider-esxi's People

Contributors

ajn142 avatar albert-edvich avatar ankhterus avatar benoit-garcia avatar berney avatar bigio avatar bish0polis avatar cennis91 avatar cutrightjm avatar dependabot[bot] avatar dglinder avatar dimdroll avatar dohq avatar ericb-summit avatar jaerhalt avatar jauderho avatar josenk avatar jpamies avatar jsfonta avatar rgl avatar seiji avatar silasb avatar simplerick0 avatar sukill avatar treekat71 avatar twss avatar voronenko avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

terraform-provider-esxi's Issues

Binary Releases are Dynamically Linked to glibc

The binary release of this plugin is dynamically linked to glibc.

When I try to run terraform on Alpine Linux I get this error:

terraform plan

Error: Error asking for user input: 2 error(s) occurred:

* module.esxi0.provider.esxi: fork/exec /root/.terraform.d/plugins/terraform-provider-esxi_v1.4.0: no such file or directory   

The file exists and is executable.

ls -l ~/.terraform.d/plugins/terraform-provider-esxi_v1.4.0 
-rwxr-xr-x    1 root     root      29819820 Feb 12 00:53 /root/.terraform.d/plugins/terraform-provider-esxi_v1.4.0

Looking at the file you can see it is dynamically linked.

file ~/.terraform.d/plugins/terraform-provider-esxi_v1.4.0
/root/.terraform.d/plugins/terraform-provider-esxi_v1.4.0: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, Go BuildID=VI2SYs4Q2VMNXpchizXh/IrW4Ik3CjPUbzSBm3BHO/yQ-rMDQpiIyKniLAqoBd/mid7UKwhB1WKuHLsfWlC, with debug_info, not stripped

It is dynamically linked to glibc

ldd ~/.terraform.d/plugins/terraform-provider-esxi_v1.4.0
        /lib64/ld-linux-x86-64.so.2 (0x7efbac846000)
        libpthread.so.0 => /lib64/ld-linux-x86-64.so.2 (0x7efbac846000)
        libc.so.6 => /lib64/ld-linux-x86-64.so.2 (0x7efbac846000)

SSH Certificate Based Auth

I have failed to setup the provider with certificate based auth, is it supported ?
My terraform.tf provides the password in the following manner and I assumed this would work due to having an authorised key.

 esxi_hostname      = "example.com"
 esxi_hostport      = "22"
 esxi_username      = "root"
 esxi_password      = ""

Upon the server itself I see a successful connection which is promptly closed most likely due to the if err != nil on line 36 of esxi_remote_cmds.go.

sshd[41540764]: Connection from 192.168.1.2 port 53656
sshd[41540764]: Connection closed by 192.168.1.2

I also noticed within the esxi_remote_cmds.go line 18
There is the following comment // Reply password to all questions
which possibly indicates that there is no opportunity for certificate based authentication at the moment.

Is this correct?
Thanks for your time this provider is an excellent concept.

Not able to see datastores

When I run terraform apply, I get an error: "Disk Store does not exists :datastore2"

But when I SSH to the esx host and run "ls -d /vmfs/volumes/datastore2"
I get "/vmfs/volumes/datastore2"

`esxi_guest.vmtest: Creating...
boot_disk_size: "" => ""
disk_store: "" => "datastore2"
guest_name: "" => "vmtest"
guest_shutdown_timeout: "" => "20"
guest_startup_timeout: "" => "60"
guestos: "" => ""
ip_address: "" => ""
memsize: "" => "4096"
network_interfaces.#: "" => "1"
network_interfaces.0.mac_address: "" => ""
network_interfaces.0.nic_type: "" => ""
network_interfaces.0.virtual_network: "" => "VM Network"
numvcpus: "" => "4"
ovf_source: "" => "/usr/lib/src/github.com/terraform-providers/terraform-provider-esxi/esx-mas-1.ovf"
power: "" => "on"
resource_pool_name: "" => ""
virthwver: "" => ""

Error: Error applying plan:

1 error(s) occurred:

  • esxi_guest.vmtest: 1 error(s) occurred:

  • esxi_guest.vmtest: Disk Store does not exists :datastore2
    `

still creating ...VM not getting created

I am using .12 version. there is no error in plan but when I apply it keep on showing message "still creating...10s" like that

when I ctrl+c .. i see following

Error: There was an ovftool Error:
C:\Users\Administrator\Documents\Learn\Terraforma_Ansible_Automation\terraform>ovftool --acceptAllEulas --noSSLVerify --X:useMacNaming=false -dm=thin --name="Kali2019.2-XFCE" --overwrite -ds="datastore1"  "C:\Users\Administrator\Documents\Virtual Machines\Kali2019.2-XFCE\Kali2019.2-XFCE.vmx" "vi://root:[email protected]/"
Opening VMX source: C:\Users\Administrator\Documents\Virtual Machines\Kali2019.2-XFCE\Kali2019.2-XFCE.vmx
Enter login information for target vi://esxi.mac.com/
Username: root
Password: **
Error: Login aborted
Completed with errors

exit status 1


  on main.tf line 8, in resource "esxi_guest" "ESXi-kali":
   8: resource "esxi_guest" "ESXi-kali" {

but if i copy paste the ovf command and run from cmd.. it works !

here is my main.tf

`provider "esxi"{
  esxi_hostname = var.esxi_hostname
  esxi_hostport = var.esxi_hostport
  esxi_username = var.esxi_username
  esxi_password = var.esxi_password
}

resource "esxi_guest" "ESXi-kali" {
  guest_name        = "Kali2019.2-XFCE"
  disk_store        = "datastore1"
  power				= "on"
  ovf_source        = "C:\\Users\\Administrator\\Documents\\Virtual Machines\\Kali2019.2-XFCE\\Kali2019.2-XFCE.vmx"
  network_interfaces {
    
      virtual_network = "esxinet"
    
  }
  guest_startup_timeout = 45
  guest_shutdown_timeout = 30
}`

Error: Unsupported argument

Using your configuration example:

provider "esxi" {
esxi_hostname = "esx01"
esxi_hostport = "22"
esxi_username = "root"
esxi_password = "xxx"
}

resource "esxi_guest" "vmtest" {
guest_name = "vmtest"
disk_store = "datastore1"
ovf_source = "/software/VM_Images/OVA/DEBIAN_9.7_X64_MINIMAL_LVM/DEBIAN_9.7_X64_MINIMAL_LVM.ova"

network_interfaces = [
{
virtual_network = "VLAN47"
},
]
}

ansible@util01:~/tf$ terraform version
Terraform v0.12.0-dev

terraform plan gets:

Error: Unsupported argument

on main.tf line 13, in resource "esxi_guest" "vmtest":
13: network_interfaces = [

An argument named "network_interfaces" is not expected here. Did you mean to
define a block of type "network_interfaces"?

Any help would be appreciated, new(ish) to Terraform.

Tests

As I start refactoring multiple parts of the code I'm really not digging the lack of tests.

I know @josenk has some manually tests that he does. I'm guessing he's doing this against a server, but not 100% sure. These are great to catch more integration issues, but for refactoring efficiently, unit tests are needed.

We've previously been down the road of getting TravisCI integrated in, but the original PR got closed. I'll willing to open that up again if we can get @josenk on board.

duplicate lines 30:31

Hi Josenk,

i'm working on a Dockerfile with terraform and your plug-in (you made a great job) and i'm hitting a syntax error

esxi/esxi_remote_cmds.go:30: syntax error: non-declaration statement outside function body

I think you duplicate two lines.

thank you for your time

Francesco

sshConfig.HostKeyCallback = ssh.InsecureIgnoreHostKey()

Injecting properties

I was trying to get the ubuntu (https://cloud-images.ubuntu.com/releases/19.04/release/ubuntu-19.04-server-cloudimg-amd64.ova) images to work using cloud-init.
After reading a lot, it seams to be no way to do this as the examples would...
Without, there is really not a good way of using this image at all, since you can't login after :/

I did however see using govc import.spec ubuntu-19.04-server-cloudimg-amd64.ova | python -m json.tool that the image has a couple of properties, both public-keys, user-data and password.

ovftoolsupports setting those if --X:injectOvfEnv is set, using params like --prop:password="myP4ssw0rd".

This would be extremely useful to have in the esxi_guest resource.

Suggestion

  • A one to one map in esxi_guest called ovf_properties ?
  • If specified, set --X:injectOvfEnv as well.

Relevant code @

ovf_cmd := fmt.Sprintf("ovftool --acceptAllEulas --noSSLVerify --X:useMacNaming=false "+
"-dm=%s --name='%s' --overwrite -ds='%s' %s '%s' '%s'", boot_disk_type, guest_name, disk_store, net_param, src_path, dst_path)

Thoughts?

I have little experience with go, terraform and those vmware tools.. But I can try to create a PR on this if it looks like a good idea..

SSH Session Reuse

Thanks for the great tool. I am finding it often plans to re-create VMs that already exist, that have no issues, or will not plan to destroy a VM that it should destroy. I think the crux of this is that the tool makes many SSH connections to run commands, each one is a new session, a new connection, and it mostly works, but sometimes due to the hammering of SSH connections, a connection will be refused. In this case a simple error string is returned and the callers don't distinguish this error from command output. So believing that the resource has the wrong setting or that the resource doesn't exist it wants to create it, or not destroy it.

I'm not very good at golang yet. I tried modifying the source to re-use sessions to find that the SSH library doesn't work like that. I tried to cache clients and to implement a retry mechanism but that resulted in terraform crashing due to a segfault - probably due to my changes in the plugin.

Could you make SSH reuse connections/channels, or similar - similar to the ssh cli equivalent of -o ControlMaster=auto -o ControlPersist=60s. Ideally with configurable values. Could you also add a retry mechanism to running the ssh commands.

ovftool Error in Windows

Hi,

The terraform plugin is working for basic planning and applying in Windows. It is, however, having issues when and ovf_source is specified. When an ovf_source is specified in Windows the following error occurs while applying a plan:

Error: Error applying plan:

1 error(s) occurred:

* esxi_guest.vmtest: 1 error(s) occurred:

* esxi_guest.vmtest: There was an ovftool Error:
exec: "/bin/bash": file does not exist

It appears to be an issue with how the ovftool is being called in windows, as the ovftool works when called in the command line. Also I get a different error when I specify an invalid ovf_source path.

Thanks,
Damian.

P.S. great work on this plugin!

Configuring Networking - vSwitches and Port Groups etc.

Do you plan to add the ability to configure ESXi networking like vSwitches and Port Groups etc?

Right now I use Ansible to configure some things, but not everything. Ideally, I'd prefer to do it all in Terraform and not have to use Ansible.

If you are interested, if I can find the time I could add some functionality using the SSH esxcli commands. Since ssh is already being used.

SCSI Controler type issue

Hello,

Thank for your work, really appreciate it,

I have an issue/feature request on the SCSI controler type. Currently, when a VM is created by default the controler type is set to "LSI Logic Parrallel" which is unrecognized by windows during the installation. For this to work natively we have to change to "LSI Logic SAS".

image

Would it be possible to have a parameter available such that we can include this value to the rtf file ?

Cant use the provider

Hi I'm using the example "01 Simple Guest" with esxi6.7 on tf plan I get the following message.

Provider "esxi" planned an invalid value for
esxi_guest.vmtest01.virtual_disks: attribute representing a list of nested
blocks must be empty to indicate no blocks, not null.

This is a bug in the provider, which should be reported in the provider's own
issue tracker.

Malfunction while guestinfo data are too large

Hi,

I try to mount a CoreOS cluster and VMWare Guestinfo provisioning fails when Ignition file gets too big (the VM boot without updated Guestinfo).

I don't know if it's a VMWare bug or something else. See attached error.log extract.

Thanks!

ip_address is not getting while in provisioner

`resource "esxi_guest" "K8SMaster" {
guest_name="K8SMaster-${var.product}"
clone_from_vm="${var.linux_image}"
memsize="8192"
numvcpus="2"
disk_store = "${var.disk_store}" # Required, Specify an existing Disk Store

provisioner "remote-exec" {
inline = [
"ls -a",
"hostname",
""
]
connection {
host="${self.ip_address}"
type="ssh"
user="xxx"
password="xxxx"
}
}
provisioner "local-exec" {
command = " echo ${esxi_guest.K8SMaster.ip_address}" >> private_ips.txt"
}

virtual_disks {
virtual_disk_id = esxi_virtual_disk.K8SMasterDisk.id
slot = "0:1"
}

network_interfaces {
     virtual_network = "VM Network" # Required for each network interface, Specify the Virtual Network name.
}

} `

Ip address is not pushing to the private_ips.txt file and some time ip_address is not able to print in output.

No destroy when add new network adapter

Hello,

We use your tool to deploy some VM with a PFSense's OVF on ESXi Free. We have to add more adapter to our VM, but when we try to do that, it wants to destroy and create the VM rather than just modify it.

Is it possible to add this feature please ?

Thanks,

Doug.

Mount CDROM ISO image

How to create a VM with an ISO mounted in the CDROM?

I would like to use cloud-init to set the hostname and other initialisation tasks. One way to inject the userdata is to use an CDROM image (ISO). However, it looks like the esxi_guest resource doesn't support such a feature.

I'm not sure if ovftool supports it changing the mounted ISO.

I am wanting to clone an existing VM several times and provide different ISOs to each, which a templated config - e.g hostname: guest0, guest1, guest2.

An alternative is use VMware GuestInfo and which can be used as cloud-init userdata source with this https://github.com/akutz/cloud-init-vmware-guestinfo

interface limits...

Why I can create not more than 3 network interfaces? Could you provide the ability to create a dynamic count of interfaces?

thanks

Set static IP Address

Is there a way to set static IP address for machine after clone?

simliar to:

network_interface {
ipv4_address = "10.0.0.1"
ipv4_netmask = 24
}

like the vSphere Provider?

Build instructions fail

The build instructions don't work for me on Mac OS. I had to make the following change to get them to work. I'm not familiar enough with go to know if this is the correct solution or not.

diff --git a/main.go b/main.go
index f3aeae6..51d23be 100644
--- a/main.go
+++ b/main.go
@@ -3,7 +3,7 @@ package main
 import (
        "github.com/hashicorp/terraform/plugin"
        "github.com/hashicorp/terraform/terraform"
-    "terraform-provider-esxi/esxi"
+    "github.com/terraform-providers/terraform-provider-esxi/esxi"
 )

 func main() {

SSH Handshake Auth Failure

make is failing with

* provider.esxi: Failed to connect to esxi host: Client Connection Error

my variables.tf file

#  See https://www.terraform.io/intro/getting-started/variables.html for more details.
#

variable "esxi_hostname" { default = "example.com" }
variable "esxi_hostport" { default = "22" }
variable "esxi_username" { default = "root" }
variable "esxi_password" { default = "Password" }

The Error

 ssh: handshake failed: ssh: unable to authenticate, attempted methods [none keyboard-interactive], no supported methods remain
[DEBUG] plugin.terraform-provider-esxi_v1.3.0: pid-41188-esxi_remote_cmds.go:38: [runRemoteSshCommand] Retry connection: 10
...9,8,7,6,etc.

sshd_config

PubkeyAuthentication no
ChallengeResponseAuthentication yes
PasswordAuthentication yes

Version Info

Terraform version: 0.11.10  
Free Esxi 6.0
go version go1.11 linux/amd64

When I write a manual ssh session in go it works fine.
The interesting thing is when I run a ssh -v the authentication for the server reports

Authentications that can continue: password,keyboard-interactive

Then in the error message above it exclaims that only [none keyboard-interactive] are being used why are we not using simple password auth ?

Any Ideas what might be going wrong with the handshake as I've tried debugging and passively observing traffic to no avail ?

Thankyou

Add notes to guest vm

Hi Jonathan,

first of all thanks a lot for your great work on this Terraform ESXi provider.

At the moment I'm working on a Cloud self service portal to provision VMs to AWS, Azure, VMWare vSphere and VMWare ESXi:

https://github.com/chrisipa/cloud-portal

So basically I'm using Terraform in combination with Ansible to do the heavy lifting. Then I have just created a responsive Web UI around everything.

When it comes to ESXi provisioning I was using Terraform as a wrapper around an Ansible playbook to create VMs on the ESXi host:

https://github.com/chrisipa/cloud-portal/blob/master/modules/cloud-portal-server/src/main/resources/usecase/vm-standalone/esxi/terraform/main.tf

I would really love to switch to your ESXi provider here.

Do think it's possible to add the ability to change the notes field of a guest VM here? That would really be great.

esxi-add-notes

I would do it myself and send you a pull request, but I'm really not a Go developer.

Best regards
Chris

Not defining a esxi_password can cause account lockouts

Using the following config, where esxi_password is non-defined appears to cause a large amount of login attempts and lockout accounts (and potentially kill the vmauth daemon)

provider "esxi" {
  esxi_hostname      = "${var.esxi_host}"
  esxi_hostport      = "${var.esxi_port}"
  esxi_username      = "${var.ssh_username}"
}
resource "esxi_guest" "lab_dc1" {
  guest_name = "lab.dc1"
  disk_store = "datastore1"
  network_interfaces {
    virtual_network = "VM Network"
  }
}

I say potentially because we had another user experience issues so it may or may not impact other users. I've not tried other use cases such as user unknown, user known: wrong password, user known: empty string. I think it would be prudent to review the way authentication is performed and perhaps bail early after authentication failures to avoid locking accounts out.

Relevant log sources when issue was reproduced

2019-08-22T17:27:18.050Z: [UserLevelCorrelator] 1864374815us: [esx.audit.ssh.enabled] SSH access has been enabled.
2019-08-22T17:28:27.269Z: [GenericCorrelator] 1933594096us: [vob.user.account.locked] Remote access for ESXi local user account 'example_user' has been locked for 900 seconds after 6 failed login attempts.
....................................
....................................
....................................
2019-08-22T17:38:10.070Z: [UserLevelCorrelator] 2516395179us: [esx.audit.account.locked] Remote access for ESXi local user account 'example_user' has been locked for 900 seconds after 32 failed login attempts.

VM Not Getting created if I specify the ovf_source.

Hello Fellows,

I'm getting the following error when specifying the ovf_source:

PS C:\Users\walla\OneDrive\Dev\Terraform\kubernetes> terraform apply

An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:

  • create

Terraform will perform the following actions:

  • esxi_guest.vmtest01
    id:
    boot_disk_size:
    boot_disk_type: "thin"
    disk_store: "datastore1"
    guest_name: "vmtest01"
    guest_shutdown_timeout: "20"
    guest_startup_timeout: "60"
    guestos:
    ip_address:
    memsize:
    network_interfaces.#: "1"
    network_interfaces.0.mac_address:
    network_interfaces.0.nic_type:
    network_interfaces.0.virtual_network: "MGMT"
    notes:
    numvcpus:
    ovf_source: "coreos_production_vmware_ova.ova"
    power: "on"
    resource_pool_name:
    virthwver:

Plan: 1 to add, 0 to change, 0 to destroy.

Do you want to perform these actions?
Terraform will perform the actions described above.
Only 'yes' will be accepted to approve.

Enter a value: yes

esxi_guest.vmtest01: Creating...
boot_disk_size: "" => ""
boot_disk_type: "" => "thin"
disk_store: "" => "datastore1"
guest_name: "" => "vmtest01"
guest_shutdown_timeout: "" => "20"
guest_startup_timeout: "" => "60"
guestos: "" => ""
ip_address: "" => ""
memsize: "" => ""
network_interfaces.#: "" => "1"
network_interfaces.0.mac_address: "" => ""
network_interfaces.0.nic_type: "" => ""
network_interfaces.0.virtual_network: "" => "MGMT"
notes: "" => ""
numvcpus: "" => ""
ovf_source: "" => "coreos_production_vmware_ova.ova"
power: "" => "on"
resource_pool_name: "" => ""
virthwver: "" => ""

Error: Error applying plan:

1 error(s) occurred:

  • esxi_guest.vmtest01: 1 error(s) occurred:

  • esxi_guest.vmtest01: There was an ovftool Error: Opening OVA source: coreos_production_vmware_ova.ova
    The manifest validates
    Opening VI target: vi://[email protected]:443/
    Error: Invalid target name ("MGMT") specified in net mapping. OVF networks: VM Network. Target networks: DMZ LAN MGMT Transit Network VM Network WAN WIFI
    Completed with errors

exit status 1

Terraform does not automatically rollback in the face of errors.
Instead, your Terraform state file has been partially updated with
any resources that successfully completed. Please address the error
above and apply again to incrementally change your infrastructure.

Following the error message, I changed the network name back to "VM Network". Here's the results:

Plan: 1 to add, 0 to change, 0 to destroy.

Do you want to perform these actions?
Terraform will perform the actions described above.
Only 'yes' will be accepted to approve.

Enter a value: yes

esxi_guest.vmtest01: Creating...
boot_disk_size: "" => ""
boot_disk_type: "" => "thin"
disk_store: "" => "datastore1"
guest_name: "" => "vmtest01"
guest_shutdown_timeout: "" => "20"
guest_startup_timeout: "" => "60"
guestos: "" => ""
ip_address: "" => ""
memsize: "" => ""
network_interfaces.#: "" => "1"
network_interfaces.0.mac_address: "" => ""
network_interfaces.0.nic_type: "" => ""
network_interfaces.0.virtual_network: "" => "VM Network"
notes: "" => ""
numvcpus: "" => ""
ovf_source: "" => "coreos_production_vmware_ova.ova"
power: "" => "on"
resource_pool_name: "" => ""
virthwver: "" => ""

Error: Error applying plan:

1 error(s) occurred:

  • esxi_guest.vmtest01: 1 error(s) occurred:

  • esxi_guest.vmtest01: There was an ovftool Error: Error: Unexpected option: vi://root:@192.168.1.100/
    Completed with errors

exit status 1

Terraform does not automatically rollback in the face of errors.
Instead, your Terraform state file has been partially updated with
any resources that successfully completed. Please address the error
above and apply again to incrementally change your infrastructure.

Any help will be highly appreciated.

Thanks for this project

There was an ovftool Error: Error: Unexpected option: vi://root:[email protected]/

esxi 6.7 U2
terraform 0.12.3
terraform-provider-esxi 1.4.3
windowns 10 pro Version 1803 (OS Build 17134.829)

main.tf
variables.tf.txt

debug-log.txt

and when i test ovftool

`PS C:\Users\phai\Desktop\test-terraform> ovftool --acceptAllEulas --noSSLVerify --X:useMacNaming=false -dm=thin --name=vmtest --overwrite -ds=datastore1 --network="VM Network" E:\iso-image\ubuntu-18.04-server-cloudimg-amd64.ova vi://root:[email protected]/
Opening OVA source: E:\iso-image\ubuntu-18.04-server-cloudimg-amd64.ova
The manifest validates
Opening VI target: vi://[email protected]:443/
Warning:

  • Line 108: Unable to parse 'enableMPTSupport' for attribute 'key' on element 'Config'.
    Deploying to VI: vi://[email protected]:443/
    Transfer Completed
    Completed successfully`

can some one explain in details of using clone_from_vm and ovf_source

I am trying to deploy server using terraform.. Before that where I need to install ovftool inside the esxi server or terraform server..?

clone_from_vm argument will take running server name is it..? if it is I am facing following
I install the ovftool inside the terraform server
clone_from_vm="CentosServer-Node04"

issue.
Error: There was an ovftool Error: Opening VI source: vi://username@host_name:443/CentosServer-Node04
Error: Fault cause: vim.fault.TaskInProgress

I tried other way by using guestos option.
guestos="centos"
event I got the issue.
Capture

I am usign this terraform-provider-esxi_v1.4.3.exe version.

Please guide me.

Q: Use of esxcli, vim-cmd, etc vs govmomi

I see that the source is using mainly esxcli and vim-cmd, as well as grepping files etc to perform actions this mostly works but could there be benefits to using the govmomi library or even using the govc binary (this would increase dependencies though).

Error terraform init ()

Hi,

I already successfully used ESXi provider in the past.

For some reason, 'terraform init' is now failing. I would say esxi provider disappeared from here:
https://releases.hashicorp.com/

Here's the log I'm getting:

$terraform init

2019/01/25 10:23:47 [INFO] Terraform version: 0.11.11
2019/01/25 10:23:47 [INFO] Go runtime version: go1.11.4
2019/01/25 10:23:47 [INFO] CLI args: []string{"/usr/local/Cellar/terraform/0.11.11/bin/terraform", "init"}
2019/01/25 10:23:47 [DEBUG] Attempting to open CLI config file: /Users/i066716/.terraformrc
2019/01/25 10:23:47 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2019/01/25 10:23:47 [INFO] CLI command args: []string{"init"}
2019/01/25 10:23:47 [DEBUG] command: loading backend config file: /Users/i066716/Projects/cthulhu/infra/terraform/esxi
2019/01/25 10:23:47 [INFO] command: empty terraform config, returning nil
2019/01/25 10:23:47 [DEBUG] command: no data state file found for backend config
2019/01/25 10:23:47 [DEBUG] New state was assigned lineage "9d7ea07e-cb7f-7181-11ec-35689a4a9146"
2019/01/25 10:23:47 [INFO] command: backend initialized:
2019/01/25 10:23:47 [DEBUG] checking for provider in "."
2019/01/25 10:23:47 [DEBUG] checking for provider in "/usr/local/Cellar/terraform/0.11.11/bin"
2019/01/25 10:23:47 [DEBUG] checking for provisioner in "."
2019/01/25 10:23:47 [DEBUG] checking for provisioner in "/usr/local/Cellar/terraform/0.11.11/bin"
2019/01/25 10:23:47 [INFO] Failed to read plugin lock file .terraform/plugins/darwin_amd64/lock.json: open .terraform/plugins/darwin_amd64/lock.json: no such file or directory
2019/01/25 10:23:47 [INFO] command: backend is not enhanced, wrapping in local
2019/01/25 10:23:47 [TRACE] Preserving existing state lineage "51f8e835-280e-6f38-507d-5b99799b7845"
2019/01/25 10:23:47 [TRACE] Preserving existing state lineage "51f8e835-280e-6f38-507d-5b99799b7845"
2019/01/25 10:23:47 [DEBUG] checking for provider in "."
2019/01/25 10:23:47 [DEBUG] checking for provider in "/usr/local/Cellar/terraform/0.11.11/bin"
2019/01/25 10:23:47 [DEBUG] plugin requirements: "esxi"=""

Initializing provider plugins...

<title>403 Forbidden</title>

403 Forbidden

  • Code: AccessDenied
  • Message: Access Denied
  • RequestId: 6678949B94C4C134
  • HostId: kNKNddR1cdajGlxkG6gAqE0QLsFFrZCctipUa163f+KQSxu0zWh67Wp/HwzjAxKQe8PzG86+DBY=

2019/01/25 10:23:47 [ERROR] 1 error(s) occurred:

  • no provider exists with the given name
    2019/01/25 10:23:47 [DEBUG] plugin: waiting for all plugin processes to complete...
    Provider "esxi" not available for installation.

A provider named "esxi" could not be found in the official repository.

This may result from mistyping the provider name, or the given provider may
be a third-party provider that cannot be installed automatically.

In the latter case, the plugin must be installed manually by locating and
downloading a suitable distribution package and placing the plugin's executable
file in the following directory:
terraform.d/plugins/darwin_amd64

Terraform detects necessary plugins by inspecting the configuration and state.
To view the provider versions requested by each module, run
"terraform providers".

Thanks for your help!

The virtual machine receives the same DHCP IP address as the previous one, even if it has a different MAC address.

Hey all,

I'm having an issue on the latest Ubuntu image (ubuntu-18.04- 201806.08.0) where every VMachine I start gets assigned the same DHCP IP address as the previous. even terraform destroying it and recreating it gets the same IP (even though it has a different MAC address).
The hostnames and MAC addresses are different between the two machines. dhclient correctly claims two separate IPs, but the resolver in use is systemd-networkd.
systemd-networkd uses a different method to generate the DUID than dhclient. dhclient by default uses the link-layer address while systemd-networkd uses the contents of /etc/machine-id. Since the VMs were cloned, they have the same machine-id and the DHCP server returns the same IP for both.

To fix, replace the contents of one or both of /etc/machine-id. This can be anything, but deleting the file and running systemd-machine-id-setup will create a random machine-id in the same way done on machine setup.
For example rm -rf /etc/machine-id && systemd-machine-id-setup

Terraform packet.net

I am trying to do a terraform plan on my esxi server. This does not contain a Vsphere Server. Here is the following error I get after I have compiled the provider:
Error: Error running plan: 1 error(s) occurred:

  • provider.esxi: Failed to connect to esxi host: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none], no supported methods remain

Build instructions fail #2

Hello Jonathan,

Thank you for an awesome plugin, great work!

Seems like local import sneak into the code once more:
b2cd626

It's in released version and in master currently.

Created small PR: #56

Previous case:
#32

ESXi Password required, but not prompting user for password

Running terraform plan -input=true doesn't appear to prompt the user for credentials. Instead the command fails with

Error: Failed to connect to esxi host: Client Connection Error

  on main.tf line 1, in provider "esxi":
   1: provider "esxi" {

Is this expected behavior? I would think if ENV is not set, and the password is not provided then the application would prompt the user for a password.

From README.md
esxi_password - Required
https://learn.hashicorp.com/terraform/getting-started/variables.html#ui-input


I'm using the following config, Works fine when esxi_password is set and fails when esxi_password is not set.

provider "esxi" {
  esxi_hostname      = "${var.esxi_host}"
  esxi_hostport      = "${var.esxi_port}"
  esxi_username      = "${var.ssh_username}"
}
resource "esxi_guest" "lab_dc1" {
  guest_name = "lab.dc1"
  disk_store = "datastore1"
  network_interfaces {
    virtual_network = "VM Network"
  }
}

Userdata windows example

Please can any one share userdata to run on start up from terrafotrm for the windows systems.
Share you are thoughts on this.
How I can achieve this.

Building The Provider 1.4.1 - MACOS 10.14.3

This is just a guide. How to build the provider for MacOS.
Many Thanks author and contributors.

sudo export GOPATH="/usr/local"

sudo mkdir -p $GOPATH/src/golang.org/x/
cd $GOPATH/src/golang.org/x/
sudo git clone https://github.com/golang/crypto.git

sudo mkdir -p $GOPATH/src/github.com/hashicorp
cd $GOPATH/src/github.com/hashicorp
sudo git clone https://github.com/hashicorp/terraform.git

mkdir -p $GOPATH/src/github.com/josenk
cd $GOPATH/src/github.com/josenk
git clone https://github.com/josenk/terraform-provider-esxi.git

cd $GOPATH/src/github.com/josenk/terraform-provider-esxi
sudo go build -o terraform-provider-esxi_cat version

sudo cp terraform-provider-esxi_cat version ~/.terraform.d/plugins/

There was an ovftool Error: exit status 127

Hi
wondering if anybody run into below error.

esxi_guest.vmtest: Creating...
boot_disk_size: "" => ""
clone_from_vm: "" => "testbox01"
disk_store: "" => "datastore01"
guest_name: "" => "vmtest"
guest_shutdown_timeout: "" => ""
guest_startup_timeout: "" => ""
guestos: "" => ""
ip_address: "" => ""
memsize: "" => ""
network_interfaces.#: "" => "1"
network_interfaces.0.mac_address: "" => ""
network_interfaces.0.nic_type: "" => ""
network_interfaces.0.virtual_network: "" => "LAN Network"
notes: "" => ""
numvcpus: "" => ""
power: "" => "on"
resource_pool_name: "" => ""
virthwver: "" => ""
virtual_disks.#: "" => ""

Error: Error applying plan:

1 error occurred:
* esxi_guest.vmtest: 1 error occurred:
* esxi_guest.vmtest: There was an ovftool Error:
exit status 127

ovf_source fails with ovftool error. missing --network= parameter

I'm trying to clone an ovf into esxi and getting

Error: Error applying plan:

1 error(s) occurred:

  • esxi_guest.vmtest: 1 error(s) occurred:

2018/10/06 17:08:11 [DEBUG] plugin: waiting for all plugin processes to complete...

  • esxi_guest.vmtest: There was an ovftool Error:exit status 1

After setting TF_LOG=DEBUG I see

56238-guest-create.go:189: [guestCREATE] ovf_cmd: ovftool --acceptAllEulas --noSSLVerify --X:useMacNaming=false -dm=thin --name='vmtest' --overwrite -ds='datastore1' '/Users/morgan/Desktop/tinylinux.ovf' 'vi://root:@vhost2.home.lab/'

Running that from command line I get

Error: No network mapping specified. OVF networks: External-VM-Network. Target networks: Home Host-only Lab

If I run it adding --network="Lab" to the ovftool cmd line everything runs fine.

I was expecting the plugin to take the virtual_network specified in .tf to as the parameter.

esxi provider always wants to change virtual_disk_id even if it is not necessary

Hello there,

first of thanks alot for this awesome provider, really makes my life alot easier :)
I'm using an atomic disk layout for my linux-based VMs:

  1. HDD: 2 Partitions for /boot and /
  2. HDD: 1 Partition for swap
  3. HDD: 1 Partition for /home
  4. HDD: 1 Partition for /tmp
  5. HDD: 1 Partition for /var
  6. HDD: 1 Partition for /var/log

For some reason, the esxi provider always reports the following change when running terraform plan:

  ~ esxi_guest.my-guest
      virtual_disks.#:                 "3" => "5"
      virtual_disks.3.slot:            "" => "0:4"
      virtual_disks.3.virtual_disk_id: "" => "/vmfs/volumes/DS001/Terraform/my-guest_var.vmdk"
      virtual_disks.4.slot:            "" => "0:5"
      virtual_disks.4.virtual_disk_id: "" => "/vmfs/volumes/DS001/Terraform/my-guest_log.vmdk"

As far as I can tell, there is no change happening when running terraform apply

Cheers

network_interfaces from readme.md seems broken

The code from the readme.md seems to allow for multiple interfaces:

  network_interfaces = [
    {
      virtual_network = "VM Network"
    },
  ]

However, no combination of syntactical massaging seems to allow me to use that syntax to instantiate even a single interface.

This format seems to work for a single interface:

  network_interfaces {
    virtual_network = "VM Network" # Required for each network interface, Specify the Virtual Network name.
  }

.. but that syntax doesn't look like it will allow multiple interfaces.

Is the example broken? Is there a new method of instantiating multiple interfaces? Can an example be created that shows multiple interfaces on different vLANs?

Unable to create multiple network adapters

Terraform 0.12.5
terraform-provider-esxi_v1.5.0.exe
Windows 10 Pro 1903

I am unable to create multiple nics using the syntax described here: https://github.com/josenk/terraform-provider-esxi#how-to-use-and-configure-a-maintf-file

When I run terraform validate I receive this error:

Error: Unsupported argument

  on main.tf line 17, in resource "esxi_guest" "WINDOWS10":
  17:   network_interfaces = [

An argument named "network_interfaces" is not expected here. Did you mean to
define a block of type "network_interfaces"?

Here is a copy of my main.tf.txt

Network adapter creation works fine when I only need one network adapter created and use this syntax:

  network_interfaces {
    virtual_network = "HOME" 
  }

Missing Guest OS Type freeBSD11-64

The freeBSD11-64 Guest OS Type is missing. VMware is happy with the VM I have created, which is used as a template, and try to cloned by terraform with this plugin.

Error: Error applying plan:

1 error(s) occurred:

* module.esxi0.esxi_guest.pfsense: 1 error(s) occurred:

* esxi_guest.pfsense: Error: invalid guestos.  see https://github.com/josenk/vagrant-vmware-esxi/wiki/VMware-ESXi-6.5-guestOS-types                                                                               

Terraform does not automatically rollback in the face of errors.
Instead, your Terraform state file has been partially updated with
any resources that successfully completed. Please address the error
above and apply again to incrementally change your infrastructure.

[user@work terraform]$ grep -i freebsd -r .
./terraform.tfstate:                            "guestos": "freeBSD11-64",
./terraform.tfstate.backup:                            "guestos": "freeBSD11-64",

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.