github.com/anfernee/terraform@v0.6.16-0.20160430000239-06e5085a92f2/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 virtual machine within the folder
    39  resource "vsphere_virtual_machine" "web" {
    40    name   = "terraform-web"
    41    folder = "${vsphere_folder.frontend.path}"
    42    vcpu   = 2
    43    memory = 4096
    44  
    45    network_interface {
    46      label = "VM Network"
    47    }
    48  
    49    disk {
    50      template = "centos-7"
    51    }
    52  }
    53  ```
    54  
    55  ## Argument Reference
    56  
    57  The following arguments are used to configure the VMware vSphere Provider:
    58  
    59  * `user` - (Required) This is the username for vSphere API operations. Can also
    60    be specified with the `VSPHERE_USER` environment variable.
    61  * `password` - (Required) This is the password for vSphere API operations. Can
    62    also be specified with the `VSPHERE_PASSWORD` environment variable.
    63  * `vsphere_server` - (Required) This is the vCenter server name for vSphere API
    64    operations. Can also be specified with the `VSPHERE_SERVER` environment
    65    variable.
    66  * `allow_unverified_ssl` - (Optional) Boolean that can be set to true to
    67    disable SSL certificate verification. This should be used with care as it
    68    could allow an attacker to intercept your auth token. If omitted, default
    69    value is `false`. Can also be specified with the `VSPHERE_ALLOW_UNVERIFIED_SSL`
    70    environment variable.
    71  
    72  ## Required Privileges
    73  
    74  In order to use Terraform provider as non priviledged user, a Role within
    75  vCenter must be assigned the following privileges:
    76  
    77  * Datastore
    78     - Allocate space
    79     - Browse datastore
    80     - Low level file operations
    81     - Remove file
    82     - Update virtual machine files
    83     - Update virtual machine metadata
    84  
    85  * Folder (all)
    86     - Create folder
    87     - Delete folder
    88     - Move folder
    89     - Rename folder
    90  
    91  * Network
    92     - Assign network
    93  
    94  * Resource
    95     - Apply recommendation
    96     - Assign virtual machine to resource pool
    97  
    98  * Virtual Machine
    99     - Configuration (all) - for now
   100     - Guest Operations (all) - for now
   101     - Interaction (all)
   102     - Inventory (all)
   103     - Provisioning (all)
   104  
   105  These settings were tested with [vSphere
   106  6.0](https://pubs.vmware.com/vsphere-60/index.jsp?topic=%2Fcom.vmware.vsphere.security.doc%2FGUID-18071E9A-EED1-4968-8D51-E0B4F526FDA3.html)
   107  and [vSphere
   108  5.5](https://pubs.vmware.com/vsphere-55/index.jsp?topic=%2Fcom.vmware.vsphere.security.doc%2FGUID-18071E9A-EED1-4968-8D51-E0B4F526FDA3.html).
   109  For additional information on roles and permissions, please refer to official
   110  VMware documentation.
   111  
   112  ## Virtual Machine Customization
   113  
   114  Guest Operating Systems can be configured using
   115  [customizations](https://pubs.vmware.com/vsphere-50/index.jsp#com.vmware.vsphere.vm_admin.doc_50/GUID-80F3F5B5-F795-45F1-B0FA-3709978113D5.html),
   116  in order to set things properties such as domain and hostname. This mechanism
   117  is not compatible with all operating systems, however. A list of compatible
   118  operating systems can be found
   119  [here](http://partnerweb.vmware.com/programs/guestOS/guest-os-customization-matrix.pdf)
   120  
   121  If customization is attempted on an operating system which is not supported, Terraform will
   122  create the virtual machine, but fail with the following error message:
   123  
   124  ```
   125  Customization of the guest operating system 'debian6_64Guest' is not
   126  supported in this configuration. Microsoft Vista (TM) and Linux guests with
   127  Logical Volume Manager are supported only for recent ESX host and VMware Tools
   128  versions. Refer to vCenter documentation for supported configurations.  ```
   129  ```
   130  
   131  In order to skip the customization step for unsupported operating systems, use
   132  the `skip_customization` argument on the virtual machine resource.
   133  
   134  ## Acceptance Tests
   135  
   136  The VMware vSphere provider's acceptance tests require the above provider
   137  configuration fields to be set using the documented environment variables.
   138  
   139  In addition, the following environment variables are used in tests, and must be
   140  set to valid values for your VMware vSphere environment:
   141  
   142   * VSPHERE\_NETWORK\_GATEWAY
   143   * VSPHERE\_NETWORK\_IP\_ADDRESS
   144   * VSPHERE\_NETWORK\_LABEL
   145   * VSPHERE\_NETWORK\_LABEL\_DHCP
   146   * VSPHERE\_TEMPLATE
   147  
   148  The following environment variables depend on your vSphere environment:
   149  
   150   * VSPHERE\_DATACENTER
   151   * VSPHERE\_CLUSTER
   152   * VSPHERE\_RESOURCE\_POOL
   153   * VSPHERE\_DATASTORE
   154  
   155  The following additional environment variables are needed for running the
   156  "Mount ISO as CDROM media" acceptance tests.
   157  
   158   * VSPHERE\_CDROM\_DATASTORE
   159   * VSPHERE\_CDROM\_PATH
   160  
   161  
   162  These are used to set and verify attributes on the `vsphere_virtual_machine`
   163  resource in tests.
   164  
   165  Once all these variables are in place, the tests can be run like this:
   166  
   167  ```
   168  make testacc TEST=./builtin/providers/vsphere
   169  ```
   170  
   171