github.com/anfernee/terraform@v0.6.16-0.20160430000239-06e5085a92f2/website/source/docs/providers/vsphere/r/virtual_machine.html.markdown (about)

     1  ---
     2  layout: "vsphere"
     3  page_title: "VMware vSphere: vsphere_virtual_machine"
     4  sidebar_current: "docs-vsphere-resource-virtual-machine"
     5  description: |-
     6    Provides a VMware vSphere virtual machine resource. This can be used to create, modify, and delete virtual machines.
     7  ---
     8  
     9  # vsphere\_virtual\_machine
    10  
    11  Provides a VMware vSphere virtual machine resource. This can be used to create,
    12  modify, and delete virtual machines.
    13  
    14  ## Example Usage
    15  
    16  ```
    17  resource "vsphere_virtual_machine" "web" {
    18    name   = "terraform_web"
    19    vcpu   = 2
    20    memory = 4096
    21  
    22    network_interface {
    23      label = "VM Network"
    24    }
    25  
    26    disk {
    27      template = "centos-7"
    28    }
    29  }
    30  ```
    31  
    32  ## Example Usage VMware Cluster
    33  
    34  ```
    35  resource "vsphere_virtual_machine" "lb" {
    36    name   = "lb01"
    37    folder = "Loadbalancers"
    38    vcpu   = 2
    39    memory = 4096
    40    domain = "MYDOMAIN"
    41    datacenter = "EAST"
    42    cluster = "Production Cluster"
    43    resource_pool = "Production Cluster/Resources/Production Servers"
    44  
    45    gateway = "10.20.30.254"
    46  
    47    network_interface {
    48        label = "10_20_30_VMNet"
    49        ipv4_address = "10.20.30.40"
    50        ipv4_prefix_length = "24"
    51    }
    52  
    53    disk {
    54      datastore = "EAST/VMFS01-EAST"
    55      template = "Templates/Centos7"
    56    }
    57  }
    58  ```
    59  
    60  ## Argument Reference
    61  
    62  The following arguments are supported:
    63  
    64  * `name` - (Required) The virtual machine name
    65  * `vcpu` - (Required) The number of virtual CPUs to allocate to the virtual machine
    66  * `memory` - (Required) The amount of RAM (in MB) to allocate to the virtual machine
    67  * `memory_reservation` - (Optional) The amount of RAM (in MB) to reserve physical memory resource; defaults to 0 (means not to reserve)
    68  * `datacenter` - (Optional) The name of a Datacenter in which to launch the virtual machine
    69  * `cluster` - (Optional) Name of a Cluster in which to launch the virtual machine
    70  * `resource_pool` (Optional) The name of a Resource Pool in which to launch the virtual machine. Requires full path (see cluster example).
    71  * `gateway` - (Optional) Gateway IP address to use for all network interfaces
    72  * `domain` - (Optional) A FQDN for the virtual machine; defaults to "vsphere.local"
    73  * `time_zone` - (Optional) The [Linux](https://www.vmware.com/support/developer/vc-sdk/visdk41pubs/ApiReference/timezone.html) or [Windows](https://msdn.microsoft.com/en-us/library/ms912391.aspx) time zone to set on the virtual machine. Defaults to "Etc/UTC"
    74  * `dns_suffixes` - (Optional) List of name resolution suffixes for the virtual network adapter
    75  * `dns_servers` - (Optional) List of DNS servers for the virtual network adapter; defaults to 8.8.8.8, 8.8.4.4
    76  * `network_interface` - (Required) Configures virtual network interfaces; see [Network Interfaces](#network-interfaces) below for details.
    77  * `disk` - (Required) Configures virtual disks; see [Disks](#disks) below for details
    78  * `cdrom` - (Optional) Configures a CDROM device and mounts an image as its media; see [CDROM](#cdrom) below for more details.
    79  * `boot_delay` - (Optional) Time in seconds to wait for machine network to be ready.
    80  * `windows_opt_config` - (Optional) Extra options for clones of Windows machines.
    81  * `linked_clone` - (Optional) Specifies if the new machine is a [linked clone](https://www.vmware.com/support/ws5/doc/ws_clone_overview.html#wp1036396) of another machine or not.
    82  * `custom_configuration_parameters` - (Optional) Map of values that is set as virtual machine custom configurations.
    83  * `skip_customization` - (Optional) skip virtual machine customization (useful if OS is not in the guest OS support matrix of VMware like "other3xLinux64Guest").
    84  
    85  The `network_interface` block supports:
    86  
    87  * `label` - (Required) Label to assign to this network interface
    88  * `ipv4_address` - (Optional) Static IP to assign to this network interface. Interface will use DHCP if this is left blank. Currently only IPv4 IP addresses are supported.
    89  * `ipv4_prefix_length` - (Optional) prefix length to use when statically assigning an IP.
    90  
    91  The following arguments are maintained for backwards compatibility and may be
    92  removed in a future version:
    93  
    94  * `ip_address` - __Deprecated, please use `ipv4_address` instead_.
    95  * `subnet_mask` - __Deprecated, please use `ipv4_prefix_length` instead_.
    96  
    97  The `windows_opt_config` block supports:
    98  
    99  * `product_key` - (Optional) Serial number for new installation of Windows. This serial number is ignored if the original guest operating system was installed using a volume-licensed CD.
   100  * `admin_password` - (Optional) The password for the new `administrator` account. Omit for passwordless admin (using `""` does not work).
   101  * `domain` - (Optional) Domain that the new machine will be placed into. If `domain`, `domain_user`, and `domain_user_password` are not all set, all three will be ignored.
   102  * `domain_user` - (Optional) User that is a member of the specified domain.
   103  * `domain_user_password` - (Optional) Password for domain user, in plain text.
   104  
   105  <a id="disks"></a>
   106  ## Disks
   107  
   108  The `disk` block supports:
   109  
   110  * `template` - (Required if size and bootable_vmdk_path not provided) Template for this disk.
   111  * `datastore` - (Optional) Datastore for this disk
   112  * `size` - (Required if template and bootable_vmdks_path not provided) Size of this disk (in GB).
   113  * `iops` - (Optional) Number of virtual iops to allocate for this disk.
   114  * `type` - (Optional) 'eager_zeroed' (the default), or 'thin' are supported options.
   115  * `vmdk` - (Required if template and size not provided) Path to a vmdk in a vSphere datastore. 
   116  * `bootable` - (Optional) Set to 'true' if a vmdk was given and it should attempt to boot after creation.
   117  
   118  <a id="cdrom"></a>
   119  ## CDROM
   120  
   121  The `cdrom` block supports:
   122  
   123  * `datastore` - (Required) The name of the datastore where the disk image is stored.
   124  * `path` - (Required) The absolute path to the image within the datastore.
   125  
   126  ## Attributes Reference
   127  
   128  The following attributes are exported:
   129  
   130  * `id` - The instance ID.
   131  * `name` - See Argument Reference above.
   132  * `vcpu` - See Argument Reference above.
   133  * `memory` - See Argument Reference above.
   134  * `datacenter` - See Argument Reference above.
   135  * `network_interface/label` - See Argument Reference above.
   136  * `network_interface/ipv4_address` - See Argument Reference above.
   137  * `network_interface/ipv4_prefix_length` - See Argument Reference above.
   138  * `network_interface/ipv6_address` - Assigned static IPv6 address.
   139  * `network_interface/ipv6_prefix_length` - Prefix length of assigned static IPv6 address.