10

Terraform VMware Cloud Director Provider - 3.2.0 Release

 3 years ago
source link: https://blogs.vmware.com/cloudprovider/2021/03/terraform-vmware-cloud-director-provider-3-2-0-release.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

We have a new release of Terraform VMware Cloud Director Provider. Version 3.2.0 is now available, with some substantial improvements.

What’s New in Terraform VCD Provider 3.2.0

We have expanded support for NSX-T with four new resources and corresponding data sources:

vcd_network_routed_v2 and vcd_network_isolated_v2 should be used for both NSX-V and NSX-T backed VDCs. Their older versions vcd_network_routed and vcd_network_isolated should only be used if DHCP pool configuration is required for NSX-V backed VDCs.

We also have a new resource and corresponding data source vcd_vm which provides support for a standalone VM. It works with all the properties and attributes of vcd_vapp_vm, with the difference that we can’t set a vapp_name. The main benefit of this resource is that allows parallel creation and update of VMs. While creation of multiple VMs inside a vApp will be serialised, multiple standalone VMs are handled in parallel. As a quick example, the creation of 10 VMs within a vApp (18GB each) takes 21 minutes, while the corresponding creation of 10 standalone VMs takes less than 3 minutes.

1 vApp with 10 VMs
          with network     bare VM
          ------------     -----------
Apply     21m  5.097s      12m 24.084s
Destroy    5m 47.492s       4m 26.281s
10 standalone VM
          with network     bare VM
          ------------     -----------
Apply      2m 58.690s       1m 31.818s
Destroy    1m 15.381s       0m 40.361s

You can quickly try the multiple VM creation with the trick below.

resource "vcd_vm" "TestMultiStandalone" {
  for_each      = toset([ "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten"])
  org           = "datacloud"
  vdc           = "vdc-datacloud"
  name          = each.value
  catalog_name  = "cat-datacloud"
  template_name = "photon-hw11"
  memory        = 1024
  cpus          = 1
  power_on      = false

Let’s see a quick example of one the new network resources:

data "vcd_nsxt_edgegateway" "existing" {
  org  = "datacloud"
  vdc  = "nsxt-vdc-datacloud"
  name = "nsxt-gw-datacloud"
resource "vcd_network_routed_v2" "net_r_v2" {
  name            = "net_r_v2"
  org             = "datacloud"
  vdc             = "nsxt-vdc-datacloud"
  edge_gateway_id = data.vcd_nsxt_edgegateway.existing.id
  gateway         = "10.10.102.1"
  prefix_length   = 24
  static_ip_pool {
    start_address = "10.10.102.2"
    end_address   = "10.10.102.200"

In this configuration, we create a data source of a vcd_nsxt_edgegateway. We need it to use its ID with the vcd_network_routed_v2, which requires the edge gateway ID to be created. To add DHCP pools, we use a separate resource that refers to the network by ID, like in the example below.

resource "vcd_nsxt_network_dhcp" "net_r_dhcp" {
  org             = "datacloud"
  vdc             = "nsxt-vdc-datacloud"
  org_network_id  = vcd_network_routed_v2.net_r_v2.id
  pool {
    start_address = "10.10.102.210"
    end_address   = "10.10.102.220"
  pool {
    start_address = "10.10.102.230"
    end_address   = "10.10.102.240"

You can see all resources mentioned here used together at this example, which contains a standalone VM connected to three of the new network resources, with an additional vcd_nsxt_network_dhcp that handles the DHCP settings of a vcd_network_routed_v2.

Where can I get Terraform VCD Provider 3.2.0 from?

This 3.2.0 release is hosted in the Terraform registry and supports the latest Terraform 0.14 version.

Provider is available in the registry as of 3.0.0 release.

Documentation can be accessed on the site.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK