2015-10-12 18:42:27 +02:00
|
|
|
---
|
|
|
|
layout: "vsphere"
|
2015-11-03 03:21:08 +01:00
|
|
|
page_title: "Provider: VMware vSphere"
|
2015-10-12 18:42:27 +02:00
|
|
|
sidebar_current: "docs-vsphere-index"
|
|
|
|
description: |-
|
2015-11-03 03:21:08 +01:00
|
|
|
The VMware vSphere provider is used to interact with the resources supported by
|
|
|
|
VMware vSphere. The provider needs to be configured with the proper credentials
|
|
|
|
before it can be used.
|
2015-10-12 18:42:27 +02:00
|
|
|
---
|
|
|
|
|
2015-11-03 03:21:08 +01:00
|
|
|
# VMware vSphere Provider
|
2015-10-12 18:42:27 +02:00
|
|
|
|
2015-11-03 03:21:08 +01:00
|
|
|
The VMware vSphere provider is used to interact with the resources supported by
|
|
|
|
VMware vSphere.
|
2015-10-12 18:42:27 +02:00
|
|
|
The provider needs to be configured with the proper credentials before it can be used.
|
|
|
|
|
|
|
|
Use the navigation to the left to read about the available resources.
|
|
|
|
|
2015-11-03 03:21:08 +01:00
|
|
|
~> **NOTE:** The VMware vSphere Provider currently represents _initial support_
|
2015-11-18 05:53:55 +01:00
|
|
|
and therefore may undergo significant changes as the community improves it. This
|
|
|
|
provider at this time only supports IPv4 addresses on virtual machines.
|
2015-10-15 16:35:06 +02:00
|
|
|
|
2015-10-12 18:42:27 +02:00
|
|
|
## Example Usage
|
|
|
|
|
|
|
|
```
|
2015-11-03 03:21:08 +01:00
|
|
|
# Configure the VMware vSphere Provider
|
2015-10-12 18:42:27 +02:00
|
|
|
provider "vsphere" {
|
|
|
|
user = "${var.vsphere_user}"
|
|
|
|
password = "${var.vsphere_password}"
|
2015-11-01 15:07:23 +01:00
|
|
|
vsphere_server = "${var.vsphere_server}"
|
2015-10-12 18:42:27 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
# Create a virtual machine
|
|
|
|
resource "vsphere_virtual_machine" "web" {
|
|
|
|
name = "terraform_web"
|
|
|
|
vcpu = 2
|
|
|
|
memory = 4096
|
|
|
|
|
|
|
|
network_interface {
|
|
|
|
label = "VM Network"
|
|
|
|
}
|
|
|
|
|
|
|
|
disk {
|
|
|
|
size = 1
|
|
|
|
iops = 500
|
|
|
|
}
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
## Argument Reference
|
|
|
|
|
2015-11-03 03:21:08 +01:00
|
|
|
The following arguments are used to configure the VMware vSphere Provider:
|
2015-10-12 18:42:27 +02:00
|
|
|
|
|
|
|
* `user` - (Required) This is the username for vSphere API operations. Can also
|
|
|
|
be specified with the `VSPHERE_USER` environment variable.
|
|
|
|
* `password` - (Required) This is the password for vSphere API operations. Can
|
|
|
|
also be specified with the `VSPHERE_PASSWORD` environment variable.
|
2015-11-01 15:07:23 +01:00
|
|
|
* `vsphere_server` - (Required) This is the vCenter server name for vSphere API
|
|
|
|
operations. Can also be specified with the `VSPHERE_SERVER` environment
|
2015-10-12 18:42:27 +02:00
|
|
|
variable.
|
|
|
|
|
2015-10-29 13:48:11 +01:00
|
|
|
## Acceptance Tests
|
|
|
|
|
2015-11-03 03:21:08 +01:00
|
|
|
The VMware vSphere provider's acceptance tests require the above provider
|
2015-10-29 13:48:11 +01:00
|
|
|
configuration fields to be set using the documented environment variables.
|
|
|
|
|
2015-11-03 03:21:08 +01:00
|
|
|
In addition, the following environment variables are used in tests, and must be set to valid values for your VMware vSphere environment:
|
2015-10-29 13:48:11 +01:00
|
|
|
|
|
|
|
* VSPHERE\_NETWORK\_GATEWAY
|
|
|
|
* VSPHERE\_NETWORK\_IP\_ADDRESS
|
|
|
|
* VSPHERE\_NETWORK\_LABEL
|
|
|
|
* VSPHERE\_NETWORK\_LABEL\_DHCP
|
|
|
|
* VSPHERE\_TEMPLATE
|
2015-10-30 10:18:25 +01:00
|
|
|
|
|
|
|
The following environment variables depend on your vSphere environment:
|
2015-11-18 05:53:55 +01:00
|
|
|
|
2015-10-30 10:18:25 +01:00
|
|
|
* VSPHERE\_DATACENTER
|
|
|
|
* VSPHERE\_CLUSTER
|
|
|
|
* VSPHERE\_RESOURCE\_POOL
|
|
|
|
* VSPHERE\_DATASTORE
|
|
|
|
|
2015-10-29 13:48:11 +01:00
|
|
|
|
|
|
|
These are used to set and verify attributes on the `vsphere_virtual_machine`
|
|
|
|
resource in tests.
|
|
|
|
|
|
|
|
Once all these variables are in place, the tests can be run like this:
|
|
|
|
|
|
|
|
```
|
|
|
|
make testacc TEST=./builtin/providers/vsphere
|
|
|
|
```
|