Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Support importing vsphere_virtual_machine resources #9535

Closed
jaredledvina opened this issue Oct 23, 2016 · 5 comments
Closed

Comments

@jaredledvina
Copy link
Contributor

Terraform Version

Terraform v0.7.7

Affected Resource(s)

  • vsphere_virtual_machine

Expected Behavior

The following command would successfully import the resource into the tfstate file.

terraform import vsphere_virtual_machine.name id

Actual Behavior

The command above fails with:

❯ terraform import vsphere_virtual_machine.name id
provider.vsphere.password
  The user password for vSphere API operations.

  Enter a value: <super-secret-password>

provider.vsphere.user
  The user name for vSphere API operations.

  Enter a value: <username>

provider.vsphere.vsphere_server
  The vSphere Server name for vSphere API operations.

  Enter a value: <fqdn>

vsphere_virtual_machine.name: Importing from ID "id"...
Error importing: 1 error(s) occurred:

* import vsphere_virtual_machine.name (id: id): resource vsphere_virtual_machine doesn't support import
@davwilliams
Copy link

davwilliams commented May 21, 2017

Any update on this? vSphere is a major platform that we provision infrastructure for using TF (and it's still no. 1 in the enterprise), but often are faced with the need to "import" existing infrastructure. We would be happy to contribute this functionality, but don't completely understand the import functionality as it's not well-documented and only a few supported platforms to compare to.

@fkgre
Copy link

fkgre commented Jun 2, 2017

+1

@billyjsubs
Copy link

+1
I too am starting to investigate the possibilities here. If I find any further information on importing I will update here,....hopefully somebody else has encountered this also and could advise.

@mpuckett159
Copy link

Based on the error in the OP the issue was that the provider was not configured properly. It is necessary to have the following configured in your environment:

provider "vsphere" {
  user = "username"
  password = "password"
  vsphere_server = "FQDNorIP"
  allow_unverified_ssl = true
}

I have mine in a general configuration.tf file where I have a bunch of static information defined for the environment.

In addition, you can find the exact syntax for how to designate the VM to import here towards the bottom under the Import section header. Specifically, the command will look like:

terraform import vsphere_virtual_machine.vm /datacentername/vm/folder/vmname

I am successfully executing this with the following versions of Terraform and the vSphere provider:
Terraform v0.11.11
provider.vsphere v1.9.1

@ghost
Copy link

ghost commented Mar 30, 2020

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.

@ghost ghost locked and limited conversation to collaborators Mar 30, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants