HashiCorp Terraform
VMware Cloud Provider

vCloud Director Embraces Terraform

This year marks a focused support for HashiCorp Terraform in VMware vCloud Director (vCD). The refreshed Terraform vCloud Director provider enables administrators and DevOps engineers to define vCD infrastructure as code inside Terraform configuration files. This makes it an efficient automation and integration tool.

We already released two new provider versions this year (v2.0.0 and v2.1.0). More releases are on the way. Most importantly, with the latest version you can automate creation of the following resources:

  • Catalog with ability to upload OVA and ISO items to it
  • Org VDC networks (routed, direct and isolated)
  • vApp and vApp level networks
  • VMs, which can use the uploaded OVA, networks and mount an ISO when needed
  • Firewall rules and DNAT/SNAT rules that can enable access to the VMs
  • Independent disks and ability to attach them to the VMs
  • Various VM configuration parameters: CPU and cores, custom boot script, etc.

Please see the official documentation at the HashiCorp portal below for all currently available features and details. Note, that current release supports all vCD versions from v8.20 to the latest v9.7.

https://www.terraform.io/docs/providers/vcd/index.html

Open-Source and 100% written in Go

The project itself is fully open-source and available on GitHub. HashiCorp is hosting it in the “terraform-providers” namespace together with all the other official Terraform providers. If you’d like to contribute with a feature request, report an issue or propose a code improvement please visit the project’s site below. There you can also see current activity and what’s in the works.

https://github.com/terraform-providers/terraform-provider-vcd

To make it trivial to setup and use, Terraform vCloud Director Provider v2 is using Go programming language exclusively (just like the overall Terraform platform). This means we are also able to fully integrate it with HashiCorp build and download system. As a result for a user, all it takes to get the new provider is to prepare a .tf configuration file, define the “vcd” provider there and execute terraform init from the console. Terraform will take care of downloading and enabling the provider for you.

`terraform init` downloads the vCloud Director provider

It’s worth noting that for making calls to vCloud Director API the provider is using a Go library (SDK). This library is also open-source and available on GitHub below. Please take a look if you are developing applications written in Go and need an easy way of calling vCloud Director.

https://github.com/vmware/go-vcloud-director

Example Configuration

Here’s a small .tf configuration file that illustrates how you could automate creation of a catalog, upload an OVA to it, and also create an independent disk. You can similarly extend this example to create a vApp with VM that would use all these items.

Next Steps

All in all, we are actively working on further extending and enhancing functionality of the Terraform vCD provider. Likewise, we are also supporting community efforts around it and doing our best to (a) listen to feedback and (b) help merge the code from contributors in an efficient, safe and high quality way. Hence, if you’re a Terraform user or have questions, please join us on GitHub or come by to our Slack channel for a chat!

Here are the take-away links from this post.

Hope to see you there!