terraform-provider-vcd icon indicating copy to clipboard operation
terraform-provider-vcd copied to clipboard

Add support for vApp template

Open AlexanderB1290 opened this issue 3 years ago • 6 comments

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.

AlexanderB1290 avatar Nov 11 '21 14:11 AlexanderB1290

Related to #502

dataclouder avatar Nov 12 '21 08:11 dataclouder

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.

vbauzys avatar Jan 21 '22 14:01 vbauzys

@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 avatar Mar 10 '22 10:03 AlexanderB1290

@AlexanderB1290 can you share for which company this is needed? :)

vbauzys avatar Mar 17 '22 09:03 vbauzys

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 :(

carlschroder avatar Mar 22 '22 11:03 carlschroder

@vbauzysvmware For VMware. :) I am part of the Global Labs and we are supporting several cloud locations using vCD.

AlexanderB1290 avatar Apr 28 '22 10:04 AlexanderB1290

Implemented in v3.10.0

vcd_cloned_vapp

dataclouder avatar Jul 20 '23 12:07 dataclouder