github.com/jrasell/terraform@v0.6.17-0.20160523115548-2652f5232949/website/source/docs/providers/vsphere/index.html.markdown (about) 1 --- 2 layout: "vsphere" 3 page_title: "Provider: VMware vSphere" 4 sidebar_current: "docs-vsphere-index" 5 description: |- 6 The VMware vSphere provider is used to interact with the resources supported by 7 VMware vSphere. The provider needs to be configured with the proper credentials 8 before it can be used. 9 --- 10 11 # VMware vSphere Provider 12 13 The VMware vSphere provider is used to interact with the resources supported by 14 VMware vSphere. 15 The provider needs to be configured with the proper credentials before it can be used. 16 17 Use the navigation to the left to read about the available resources. 18 19 ~> **NOTE:** The VMware vSphere Provider currently represents _initial support_ 20 and therefore may undergo significant changes as the community improves it. This 21 provider at this time only supports IPv4 addresses on virtual machines. 22 23 ## Example Usage 24 25 ``` 26 # Configure the VMware vSphere Provider 27 provider "vsphere" { 28 user = "${var.vsphere_user}" 29 password = "${var.vsphere_password}" 30 vsphere_server = "${var.vsphere_server}" 31 } 32 33 # Create a folder 34 resource "vsphere_folder" "frontend" { 35 path = "frontend" 36 } 37 38 # Create a file 39 resource "vsphere_file" "ubuntu_disk" { 40 datastore = "local" 41 source_file = "/home/ubuntu/my_disks/custom_ubuntu.vmdk" 42 destination_file = "/my_path/disks/custom_ubuntu.vmdk" 43 } 44 45 # Create a virtual machine within the folder 46 resource "vsphere_virtual_machine" "web" { 47 name = "terraform-web" 48 folder = "${vsphere_folder.frontend.path}" 49 vcpu = 2 50 memory = 4096 51 52 network_interface { 53 label = "VM Network" 54 } 55 56 disk { 57 template = "centos-7" 58 } 59 } 60 ``` 61 62 ## Argument Reference 63 64 The following arguments are used to configure the VMware vSphere Provider: 65 66 * `user` - (Required) This is the username for vSphere API operations. Can also 67 be specified with the `VSPHERE_USER` environment variable. 68 * `password` - (Required) This is the password for vSphere API operations. Can 69 also be specified with the `VSPHERE_PASSWORD` environment variable. 70 * `vsphere_server` - (Required) This is the vCenter server name for vSphere API 71 operations. Can also be specified with the `VSPHERE_SERVER` environment 72 variable. 73 * `allow_unverified_ssl` - (Optional) Boolean that can be set to true to 74 disable SSL certificate verification. This should be used with care as it 75 could allow an attacker to intercept your auth token. If omitted, default 76 value is `false`. Can also be specified with the `VSPHERE_ALLOW_UNVERIFIED_SSL` 77 environment variable. 78 79 ## Required Privileges 80 81 In order to use Terraform provider as non priviledged user, a Role within 82 vCenter must be assigned the following privileges: 83 84 * Datastore 85 - Allocate space 86 - Browse datastore 87 - Low level file operations 88 - Remove file 89 - Update virtual machine files 90 - Update virtual machine metadata 91 92 * Folder (all) 93 - Create folder 94 - Delete folder 95 - Move folder 96 - Rename folder 97 98 * Network 99 - Assign network 100 101 * Resource 102 - Apply recommendation 103 - Assign virtual machine to resource pool 104 105 * Virtual Machine 106 - Configuration (all) - for now 107 - Guest Operations (all) - for now 108 - Interaction (all) 109 - Inventory (all) 110 - Provisioning (all) 111 112 These settings were tested with [vSphere 113 6.0](https://pubs.vmware.com/vsphere-60/index.jsp?topic=%2Fcom.vmware.vsphere.security.doc%2FGUID-18071E9A-EED1-4968-8D51-E0B4F526FDA3.html) 114 and [vSphere 115 5.5](https://pubs.vmware.com/vsphere-55/index.jsp?topic=%2Fcom.vmware.vsphere.security.doc%2FGUID-18071E9A-EED1-4968-8D51-E0B4F526FDA3.html). 116 For additional information on roles and permissions, please refer to official 117 VMware documentation. 118 119 ## Virtual Machine Customization 120 121 Guest Operating Systems can be configured using 122 [customizations](https://pubs.vmware.com/vsphere-50/index.jsp#com.vmware.vsphere.vm_admin.doc_50/GUID-80F3F5B5-F795-45F1-B0FA-3709978113D5.html), 123 in order to set things properties such as domain and hostname. This mechanism 124 is not compatible with all operating systems, however. A list of compatible 125 operating systems can be found 126 [here](http://partnerweb.vmware.com/programs/guestOS/guest-os-customization-matrix.pdf) 127 128 If customization is attempted on an operating system which is not supported, Terraform will 129 create the virtual machine, but fail with the following error message: 130 131 ``` 132 Customization of the guest operating system 'debian6_64Guest' is not 133 supported in this configuration. Microsoft Vista (TM) and Linux guests with 134 Logical Volume Manager are supported only for recent ESX host and VMware Tools 135 versions. Refer to vCenter documentation for supported configurations. ``` 136 ``` 137 138 In order to skip the customization step for unsupported operating systems, use 139 the `skip_customization` argument on the virtual machine resource. 140 141 ## Acceptance Tests 142 143 The VMware vSphere provider's acceptance tests require the above provider 144 configuration fields to be set using the documented environment variables. 145 146 In addition, the following environment variables are used in tests, and must be 147 set to valid values for your VMware vSphere environment: 148 149 * VSPHERE\_IPV4\_GATEWAY 150 * VSPHERE\_IPV4\_ADDRESS 151 * VSPHERE\_IPV6\_GATEWAY 152 * VSPHERE\_IPV6\_ADDRESS 153 * VSPHERE\_NETWORK\_LABEL 154 * VSPHERE\_NETWORK\_LABEL\_DHCP 155 * VSPHERE\_TEMPLATE 156 157 The following environment variables depend on your vSphere environment: 158 159 * VSPHERE\_DATACENTER 160 * VSPHERE\_CLUSTER 161 * VSPHERE\_RESOURCE\_POOL 162 * VSPHERE\_DATASTORE 163 164 The following additional environment variables are needed for running the 165 "Mount ISO as CDROM media" acceptance tests. 166 167 * VSPHERE\_CDROM\_DATASTORE 168 * VSPHERE\_CDROM\_PATH 169 170 171 These are used to set and verify attributes on the `vsphere_virtual_machine` 172 resource in tests. 173 174 Once all these variables are in place, the tests can be run like this: 175 176 ``` 177 make testacc TEST=./builtin/providers/vsphere 178 ``` 179 180