terraform-provider-vcd
terraform-provider-vcd copied to clipboard
Add support for vApp template
Affected resources and data sources:
- vcd_vapp
- vcd_resource_list
Adding support for vApp templates will reduce the need to create new vApps from the ground up. The proposition is to add optional parameters to the mentioned resources and data source for deploying and obtaining a vApp template:
- catalog_name - corresponding to the name of the catalog from which the vApp template need to be loaded.
- template_name - corresponding to the name of the vApp template which is loaded using data source or deployed using resource respectively.
This way a vApp could be created using the following example:
resource "vcd_vapp" "my_vapp" {
name = "my_vapp_name"
catalog_name = "my_catalog_name" #Name of the catalog from which the vApp template is taken
template_name = "my_vapp_template_from_catalog" #Name of the vApp template used to deploy a new vApp
}
The vApp template can be obtained in similar way using a data source:
data "vcd_vapp" "other_vapp" {
name = "other_vapp_template" #Name of the vApp or vApp template
catalog_name = "other_vapp_template_catalog" #Name of the catalog from which to take the vApp template.
}
If the attribute catalog_name is not provided, the data source needs to return a vApp, not vApp template.
Using the vcd_resource_list to be able to obtain the names of the virtual machines inside an existing vApp template:
data "vcd_resource_list" "vm_list" {
name = "vm_list_vapp_template"
parent = "my_vapp_template_name" #Name of the vApp or vApp template
catalog_name = "my_catalog_name" #Name of the catalog from which vApp template is taken
}
If the attribute catalog_name is not provided, the data source needs to return virtual machine names from a vApp, not vApp template.
Related to #502
This may be implemented only in one way, you can deploy but not manage it after that. I mean recreate, delete ok, but any change of internal details (VM, CPU, memory, disks, customization, etc.) won't be possible as this is not how terraform HCL works.
@vbauzysvmware I am fine with this approach! In the current Global Lab environment we are always do an identical copy. So... Such customizations are done by the users only as Day-2 operations using the vCD UI. Our main goal is to use this as FaaS function exposed to the end user. The user will request this once, to create the vapp from a template, than he can handle everything he likes. We are also focusing on faster provision times. With Terraform we managed to deploy a vApp in about 30 min, compared to 2h previously.
@AlexanderB1290 can you share for which company this is needed? :)
I'd greatly appreciate this feature set too!! At first thought, I was missing something building up the vApp from current docs, but then no way to grab the vApp template contents from the content_library item :(
@vbauzysvmware For VMware. :) I am part of the Global Labs and we are supporting several cloud locations using vCD.