Terraform VMware Cloud Director Provider v3.12.0 is released, introducing many new features and improvements.
Introduction to Container Service Extensions (CSE) Kubernetes cluster resources and data sources
During the last release of the provider, we collected a huge amount of feedback from the community and understood that creating, updating, and managing Kubernetes clusters using runtime-defined entities is sometimes a difficult and non-trivial task. CSE inner workings.
This release brings major advancements to CSE users by providing the following features: all new resources and data source vcd_cse_kubernetes_clusterAbstracts Kubernetes cluster creators from dealing with the complexities of the generic methods provided. Now deprecated Kubernetes Cluster Management Guide.
The new vcd_cse_kubernetes_cluster resources are:
Resource “vcd_cse_kubernetes_cluster” “my_cluster” { cse_version = “4.2.0” name = “my-cluster” kubernetes_template_id = data.vcd_catalog_vapp_template.tkg_ova.id org = data.vcd_org_vdc.vdc.org vdc_id = data.vcd_org_vdc.vdc.id network_id = data.vcd_network_routed_v2.routed.id api_token_file = vcd_api_token.token.file_name control {machine_count = 3 disk_size_gi = 20 sizate_policy_id = data.vcd_vm_sizing_policy.tkg _small .sp.id} worker_pool {name = “worker-pool -1” machine_count = 10 disk_size_gi = 100 sizing_policy_id = data.vcd_vm_sizing_policy.tkg_small.id “delete” filesystem = “ext4” } auto_repair_on_errors = true node_health_check = true Operations_timeout_ Minutes = 0 }
One 2 three 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
|
resource “vcd_cse_kubernetes_cluster” “my_cluster” { cse_version = “4.2.0” name = “My Cluster” kubernetes_template_id = data.vcd_catalog_vapp_template.tkg_ova.ID group = data.vcd_org_vdc.vdc.group vdc_id = data.vcd_org_vdc.vdc.ID network_id = data.vcd_network_routed_v2.routed.ID api_token_file = vcd_api_token.token.file name control plane { machine_count = three disk_size_gi = 20 resize_policy_id = data.vcd_vm_sizing_policy.tkg_small.ID storage_profile_id = data.vcd_storage_profile.sp.ID } worker_pool { name = “WorkerPool-1” machine_count = 10 disk_size_gi = 100 resize_policy_id = data.vcd_vm_sizing_policy.tkg_small.ID storage_profile_id = data.vcd_storage_profile.sp.ID } default_storage_class { name = “Default storage class” storage_profile_id = data.vcd_storage_profile.sp.ID recovery_policy = “delete” file system = “ext4” } auto_repair_on_errors = truth node_health_check = truth operations_timeout_minutes = 0 } |
Readers will notice that the available arguments for this resource are quite similar to the options available in the UI when creating a Kubernetes cluster using the wizard. All RDE schemas, RDE types, and YAML files are explicitly deprecated.
Likewise, users experience a more comfortable mechanism for updating their clusters because they do not need to manipulate JSON files. Resources support all updatable elements that can be achieved using the UI. Control plane, scaling worker pools, enabling/disabling node health checks, turning off the “automatic recovery” flag (4.1.0 only).
This new resource is available in the CSE version. 4.2.1, 4.2.0, 4.1.1(a) and 4.1.0. We also support importing existing clusters for users using the usual approach to migrate existing clusters, and users can also use data sources to read existing clusters.
Added support for Container Service Extension (CSE) 4.2.0 and 4.2.1
This version of the provider updates the installation guide to support the latest versions of CSE 4.2.0 and 4.2.1.
As mentioned in the previous section, the Kubernetes cluster management guide is: Now deprecated Prefer the new vcd_cse_kubernetes_cluster resource and data source.
The provider repository now contains all the RDE type schemas required for CSE 4.2.x and some example configurations for both 4.2.0 and 4.2.1 (because configuration values such as CAPVCD version, CPI version, and CSI version are different).
Other notable changes and improvements
Consolidate VM disks on creation to support template disk overrides
The disk size has been overridden by users who frequently request missing features. Quickly provisioned VDC. Terraform provider v3.12.0 adds a new field called integration_disks_on_create to both vcd_vapp_vm and vcd_vm resources. When enabled, disks will be incorporated during VM creation. While this can be useful on its own, it also allows template disk overrides when creating VMs in a quickly provisioned VDC.
resources “vcd_vapp_vm” “resize” { vapp_name = vcd_vapp.web.name name = “Reised-OS-disk-VM” vapp_template_id = data.vcd_catalog_vapp_template.lampstack.id memory = 2048 cpus = 2 cpu_cores = 1 # A fast provisioned VDC has A disk is required. to consolidate # if size changes consolidate_disk_on_create = true override_template_disk { bus_type = “paravirtual” size_in_mb = “22384” bus_number = 0 unit_number = 0 iops = 0 storage_profile = “*” } }
One 2 three 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
|
resource “vcd_vapp_vm” “Resize” { vapp_name = vcd_vapp.knitting.name name = “Resized OS-Disk-VM” vapp_template_id = data.vcd_catalog_vapp_template.Lighthouse.ID Memory = 2048 CPU = 2 CPU_Core = One # Fast provisioned VDCs require disk consolidation. # When the size changes integrated_disk_on_create = truth override_template_disk { bus type = “Paravirtualization” size_in_mb = “22384” bus_number = 0 unit_number = 0 IOPS = 0 storage_profile = “*” } } |
VM copy support
VM resources vcd_vapp_vm and vcd_vm both get a new field copy_from_vm_id that can be used to create VMs from existing VMs instead of relying on catalog templates or empty VMs.
Data “vcd_vapp_vm” “existing” { vapp_name = data.vcd_vapp.web.name name = “web1” } Resource “vcd_vapp_vm” “vm-copy” { org = “org” vdc = “vdc” copy_from_vm_id = data.vcd_vapp_vm.existing .id # Source VM ID vapp_name = data.vcd_vapp_vm.existing.vapp_name name = “VM Copy” power_on = false }
|
data “vcd_vapp_vm” “existing” { vapp_name = data.vcd_vapp.knitting.name name = “Web1” } resource “vcd_vapp_vm” “VM-Copy” { group = “group” vdc = “vdc” copy_from_vm_id = data.vcd_vapp_vm.existing.ID # Source VM ID vapp_name = data.vcd_vapp_vm.existing.vapp_name name = “Copy VM” Power on = lie } |
Create a vApp template from a vApp or standalone VM
A final piece that increases the level of VM control is the introduction of the option to capture vApp templates from existing vApps or standalone VMs in the vcd_catalog_vapp_template resource. A new Capture_vapp block is available that accepts the source vApp ID. Additionally, vcd_vapp_vm and vcd_vm resources and data sources expose a vapp_id attribute that can be specified as a source in Capture_vapp.source_id. This is especially useful for standalone VMs with hidden vApps.
Data “vcd_catalog” “cat” { org = “v51” name = “demo-catalog” } Resource “vcd_catalog_vapp_template” “from-vapp” { org = “v51” Catalog_id = data.vcd_catalog.cat.id name = “from- vapp” Capture_vapp { source_id = vcd_vapp.web.idcustom_on_instantiate = false } lease {storage_lease_in_sec = 3600 * 24 * 3 } # Use dependencies to ensure that all VMs are in the vApp being captured. emptyVM) }
One 2 three 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
|
data “vcd_catalog” “cat” { group = “v51” name = “Demo Catalog” } resource “vcd_catalog_vapp_template” “in vapp” { group = “v51” Catalog_ID = data.vcd_catalog.cat.ID name = “in vapp” Capture_vapp { source_id = vcd_vapp.knitting.ID custom_on_instantiate = lie } lease { Storage_lease_in_sec = 3600 * 24 * three } # Use dependencies to ensure that all VMs exist in the vApp. #Capturing depends = [vcd_vapp_vm.empty VM) } |
Configure Route Advertisement for a Routed Organization VDC Network
Route advertisement toggle field Route_advertisement_enabled in resource vcd_network_routed_v2, which allows users to enable route advertisement per routed network, which works in conjunction with IP spatial route advertisement.
List of new resources and data sources
- 1 new resource:
- 2 new data sources:
There are more features and improvements that can be seen in the project’s change log. And as always, we look forward to your feedback and suggestions in GitHub issues and the #vcd-terraform-dev Slack channel (vmwarecode.slack.com).