» vcd_vapp_vm
Provides a vCloud Director VM resource. This can be used to create, modify, and delete VMs within a vApp.
Note: To make sure resources are created in the right order and both plan apply and destroy succeeds, use the depends_on clause (see example below)
» Example Usage
resource "vcd_network_direct" "net" {
name = "net"
external_network = "corp-network"
}
resource "vcd_vapp" "web" {
name = "web"
depends_on = ["vcd_network_direct.net"]
}
resource "vcd_vapp_vm" "web1" {
vapp_name = "${vcd_vapp.web.name}"
name = "web1"
catalog_name = "Boxes"
template_name = "lampstack-1.10.1-ubuntu-10.04"
memory = 2048
cpus = 2
cpu_cores = 1
network_name = "net"
ip = "10.10.104.161"
depends_on = ["vcd_vapp.web"]
}
resource "vcd_vapp_vm" "web2" {
vapp_name = "${vcd_vapp.web.name}"
name = "web2"
catalog_name = "Boxes"
template_name = "lampstack-1.10.1-ubuntu-10.04"
memory = 2048
cpus = 1
network_name = "net"
ip = "10.10.104.162"
disk {
name = "logDisk1"
bus_number = 1
unit_number = 0
}
disk {
name = "logDisk2"
bus_number = 1
unit_number = 1
}
depends_on = ["vcd_vapp.web"]
}
» Argument Reference
The following arguments are supported:
-
vapp_name- (Required) The vApp this VM should belong to. -
name- (Required) A unique name for the VM -
catalog_name- (Required) The catalog name in which to find the given vApp Template -
template_name- (Required) The name of the vApp Template to use -
memory- (Optional) The amount of RAM (in MB) to allocate to the VM -
cpus- (Optional) The number of virtual CPUs to allocate to the VM. Socket count is a result of: virtual logical processors/cores per socket -
cpu_cores- (Optional; v2.1+) The number of cores per socket -
initscript(Optional) A script to be run only on initial boot -
network_name- (Optional) Name of the network this VM should connect to -
vapp_network_name- (Optional; v2.1+) Name of the vApp network this VM should connect to -
ip- (Optional) The IP to assign to this vApp. Must be an IP address or one of "dhcp", "allocated" or "none". If given the address must be within thestatic_ip_poolset for the network. If left blank, and the network hasdhcp_poolset with at least one available IP then this will be set with DHCP. -
power_on- (Optional) A boolean value stating if this vApp should be powered on. Default istrue -
accept_all_eulas- (Optional; v2.0+) Automatically accept EULA if OVA has it. Default istrue -
org- (Optional; v2.0+) The name of organization to use, optional if defined at provider level. Useful when connected as sysadmin working across different organisations -
vdc- (Optional; v2.0+) The name of VDC to use, optional if defined at provider level -
disk- (Optional; v2.1+) Independent disk attachment configuration. Details below
Independent disk support the following attributes:
-
name- (Required) Independent disk name -
bus_number- (Required) Bus number on which to place the disk controller -
unit_number- (Required) Unit number (slot) on the bus specified by BusNumber.