Create set of VMs in vCloud Director, and vApp(s) to contain them.
This module creates the vcd_vapp
resource as well as vcd_vapp_vm
resources along with any vcd_vm_internal_disk
s or vcd_vapp_org_network
s that are required. Other resources (like vcd_independent_disk
s to be attached) will have to be created outside of this module. It assumes that the vcd
provider has already been configured.
VMs are created by passing a map
called vms
of their names to their parameters to the module. Configuring VM parameters is done in two ways:
- Passing a parameter with the appropriate value to the module - this sets a default for all VMs that will be created.
- Adding an attribute to the appropriate object in the
vms
map - this will set a VM-specific parameter or override the module default.
vapp_name
can be specified as a parameter for the module or an attribute for the VM. If neither is specified, vapp_name
will default to the VM name. Correct amount of vcd_vapp
resources will be automatically created and the VMs sharing the same vapp_name
will be associated with a single vcd_vapp
instance.
Names and formats of the parameters were taken from the vcd module to avoid confusion.
Here is an example of how this module could be used:
module "my_web_app" {
source = "telia-oss/vapp/vcd"
org_name = "my_organisation"
vdc_name = "datacenter1"
vapp_name = "my_web_vapp"
catalog_name = "internal_image_catalog"
template_name = "ubuntu-22.04"
memory = 2
cpus = 1
cpu_cores = 2
vms = {
web1 = {
disks = [
{
name = "backups"
bus_number = 1
unit_number = 0
}
]
networks = {
"external_network" = { ip = "1.0.0.1" }
}
}
web2 = {
networks = {
"external_network" = { ip = "1.0.0.2" }
}
}
custom-web1 = {
vapp_name = "my_custom_web_vapp"
disks = [
{
name = "backups"
bus_number = 1
unit_number = 0
}
]
networks = {
"external_network" = { ip = "1.0.1.1" }
}
}
custom-web2 = {
vapp_name = "my_custom_web_vapp"
networks = {
"external_network" = { ip = "1.0.1.2" }
}
}
}
metadata = {
app = "my_app"
role = "web"
}
}
Name | Version |
---|---|
vcd | n/a |
Name | Description | Type | Default | Required |
---|---|---|---|---|
vms | Map of VM names and their desired configurations | map( |
n/a | yes |
catalog_name | Default catalog name to use for VMs | string |
null |
no |
cpu_cores | Default value for "cpu_cores" for VMs | number |
null |
no |
cpus | Default value for "cpus" for VMs | number |
null |
no |
customization | Default values for the VM "customization" block | object({}) |
null |
no |
internal_disks | List of default internal disks for all VMs | list( |
[] |
no |
memory | Default value for "memory" for VMs | number |
null |
no |
metadata | Metadata to assign to all created resources | map(string) |
null |
no |
networks | Default network configuration for all VMs | object({}) |
null |
no |
org_name | vCloud Director Org name to use | string |
null |
no |
override_template_disk | Override the (template) disk in VMs to this configuration | map(any) |
null |
no |
template_name | Default template name to use for VMs | string |
null |
no |
vapp_name | Name of the vApp that will be created | string |
null |
no |
vdc_name | VCD name to use | string |
null |
no |
Name | Description |
---|---|
networks | Name-indexed list of vcd_vapp_org_network resources that were attached to this vApp |
vapps | The vcd_vapp resources created by this module |
vms | Name-indexed list of VM resources created in this module |