VMware Cloud Director Availability Terraform VMware Cloud Provider

Terraform VMware Cloud Director Availability Provider

Using Terraform providers is an efficient way to define Infrastructure-as-Code and automate many operations typically done through the product UI or CLI while operating your cloud. Some of the most popular among Cloud Providers are the ones for VMware Cloud Director and vSphere, which allow managing VMs, ESXi hosts, networks, organizations, and more.

Many of these Cloud Providers also use VMware Cloud Director Availability for offering DRaaS. To simplify and optimize not only their Day 0 and Day 1 but also Day 2 operations, the Terraform VMware Cloud Director Availability Provider was created. 

What does it do?

With Terraform VMware Cloud Director Availability Provider, you can automate the following:

  • The complete initial configuration which includes applying a license key, adding external replicators, setting the lookup service, registering the VMware Cloud Director instance (for Cloud Director Replication Management Appliance), configuring the Tunnel, and more.
  • Pairing with another cloud site

These automation tasks are available for both the Cloud Director Replication Management and vCenter Replication Management appliances. Currently, the on-premises appliances are not covered.

Supported versions

The supported VMware Cloud Director Availability versions that are tested and working with the Terraform provider are:

For reference, you can visit the Terraform Provider documentation, where any newly supported version will be noted.

When to use it? 

The majority of the typical deployment and configuration tasks of VMware Cloud Director Availability are performed mostly manually, with only a few options for automation, primarily around the deployment of the appliances. The flow is as follows:

With the Terraform VMware Cloud Director Availability Provider, you can automate almost everything. This way, you can prepare your cloud for DRaaS in no time.

In addition, you can consider utilizing the Terraform vSphere Provider to deploy the VMware Cloud Director Availability appliances, which will let you optimize the whole process even further.

Please note that only cloud sites can be configured and paired.

How to use it?

Before you begin, you need to install Go 1.19 and Terraform as these are mandatory prerequisites.  

Then you need to clone the Terraform VMware Cloud Director Availability Provider GitHub repository (vmware/terraform-provider-for-vmware-cloud-director-availability.git) locally and build the provider. 

There are detailed instructions on how to do that on GitHub.

In the examples directory, you can find two subfolders:

  • cloud_director_replication_manager – contains an example code for configuring and pairing the VMware Cloud Director Availability appliances in Cloud Director clouds
  • vcenter_replication_manager – contains an example code for configuring and pairing the VMware Cloud Director Availability appliances in dedicated vSphere clouds

In both, you can find two files where the operations and the variables are defined. Using them without modification (only filing the variables.tf with the correct values) will lead to the successful configuration of your VMware Cloud Director Availability appliances and pairing them to another cloud site.

Of course, you can tune them according to your specific needs. For example, you can add actions such as configuring another replicator in which you have deployed multiple ones or remove any unnecessary actions, such as the pairing if not relevant. 

You can also enter all your variable values as default in the variables.tf or add a variable definitions file (terraform.tfvars) in addition to variables.tf, which can be used for sensitive input data.

Here is an example of how to fill in the variables.

Once you have all the variables set, you need to run terraform init, which automatically installs the Terraform provider.

Running terraform plan will show you the entire list of actions to be executed so you can review and verify all the input information is correct.

If everything is correct, running terraform apply will initiate the execution flow, and the VMware Cloud Director Availability appliances will be configured successfully.

You can find the full instructions in the README file.

Contribution

You can report issues, request new features or submit more examples on the project’s GitHub site. You can also participate in discussions in the #vcda-terraform channel hosted at the https://vmwarecode.slack.com space.

Remember, to get the latest updates, check this blog regularly, you also can find us on SlackFacebookTwitterLinkedIn as well as many demo videos and enablement YouTube, especially our Feature Fridays series!