Skip to content

Terraform Unable to use Provisioners in VM Resource when DHCP is used for IP Address #49

Closed
@mc-jared

Description

Describe the bug
The Nutanix Provider is not able to establish a connection to VM's it has created due to lacking the IP address of the Host it has just created if not provided, this prevents using DHCP for IP provisioning.

Expected behavior
The Nutanix Provider should allow the provisioners of remote-exe | file to establish connections on VM's it has just created using DHCP for IP provisioning
These provisioners would use a connection to connect to the VM's and then do what they should, copy a file | run a command | etc.

Logs
With the following inline code inside the: nutanix_virtual_machine object
connection {
type = "winrm"
user = "${var.admin_uid}"
password = "${var.admin_cid}"
}
provisioner "file" {
when = "create"
content = "test.txt"
destination = "C:\test.txt"
}
provisioner "remote-exec" {
when = "create"
inline = [
"C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe Write-Host Hello"
]
}

You get the following output until a timeout is reached:
For a remote-exec provisioner:
nutanix_virtual_machine.DB (remote-exec): Connecting to remote host via WinRM...
nutanix_virtual_machine.DB (remote-exec): Host:
nutanix_virtual_machine.DB (remote-exec): Port: 5985
nutanix_virtual_machine.DB (remote-exec): User: Administrator
nutanix_virtual_machine.DB (remote-exec): Password: true
nutanix_virtual_machine.DB (remote-exec): HTTPS: false
nutanix_virtual_machine.DB (remote-exec): Insecure: false
nutanix_virtual_machine.DB (remote-exec): NTLM: false
nutanix_virtual_machine.DB (remote-exec): CACert: false

For a File Provisioner:
nutanix_virtual_machine.DB: Provisioning with 'file'...
nutanix_virtual_machine.DB: Still creating... (20s elapsed)
nutanix_virtual_machine.DB: Still creating... (30s elapsed)
nutanix_virtual_machine.DB: Still creating... (40s elapsed)
nutanix_virtual_machine.DB: Still creating... (50s elapsed)

Versions (please complete the following information):

  • OS that is executing Terraform: Windows
  • Nutanix Prism Central: 5.10.11
  • Terraform provider version v11.13

Additional context
This is most likely related to Issue #19 but is not specific to the provisioners

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions