Cloud Management Platform Aria Automation Cloud Automation vRealize vRealize Suite

vRealize Automation – Terraform provider enhancements – Nov 2020

Recently, vRealize Automation has introduced support for vSphere’s First Class Disk (FCD) IaaS APIs then the latest Terraform Provider for vRealize Automation version 0.3.4 immediately took advantage of it and made it available while also getting verified at the at the Terraform Registry, let’s explore further.

Verified to be part of Hashicorp Terraform registry

If you have used the Terraform Provider for vRealize Automation before, you knew you could download it from vmware/terraform-provider-vra project, however now it is possible to pull it down directly from the Terraform Registry but most importantly, you can do it with confidence as it has been Verified by HashiCorp.

Terraform Provider for vRealize Automation version 0.3.4

What does this mean? well, the Terraform providers are published and maintained by a variety of sources, private or public, the Registry uses tiers and badges to denote the source of a provider. Additionally, namespaces are used to help users identify the organization or publisher responsible for the integration.

Verified providers are owned and maintained by third-party technology partners. Providers in this tier indicate that HashiCorp has verified the authenticity of the Provider’s publisher, and that the partner is a member of the HashiCorp Technology Partner Program.

Support First Class Disk resource type in Terraform Provider for vRealize Automation

A first class disk (FCD) provides storage life-cycle management on virtual disks as a disk-as-a service or as EBS-like disk storage that allows you to create and manage disks independently.

A FCD disk has its own life-cycle management capabilities that operate independently from a VM. One way that a first class disk differs from an independent persistent disk, is that you can use a first class disk to create and manage snapshots independent of any VM.

To learn more about this feature take a look at this link: What can I do with first class disk storage in vRealize Automation Cloud

vRealize Automation supports two categories of storage disks – standard disk and first class disk. First class disk functionality is supported for vSphere only and vRealize Automation currently provides first class disk functionality as an API-only capability.

Now, with the Terraform Provider for vRealize Automation version 0.3.4 it was introduced a couple of new Resources and Data Sources to manage first class disk (FCD) :

vra_block_device : Allows you to manage block devices.

vra_block_device_snapshot : Allows you to manage block device snapshots.

The following HCL code shows how to create a 10Gb FCD Device:

It also leverages tag constraints:  “disk:fcd & “cloud:vsphere”  for targeting a specific Storage Profile with FCD support.

 

 

And when we apply this code (terrraform apply), you will notice that a new Deployment is create for our FCD in the appropriate Datastore at vRealize Automation

 

 

In fact, if you inspect further the deployment, you will find the FCD’s detailed information (same kind of data that you would get with a terraform show command), and additionally, 2nd day Actions get exposed such as “Resize Disk”.

 

 

Then it is common that as part of any VM’s Disk operation, you had to manage snapshots and for that you could use the vra_block_device_snapshot resource.

Furthermore, you could also attach FCDs to a vRealize Automation vSphere Machine at once, as shown in the following code, which defines a couple of FCD Disk and a vSphere Machine

Let’s try it:

$ terraform apply --auto-approve
data.vra_cloud_account_vsphere.this: Refreshing state...
data.vra_project.this: Refreshing state...
data.vra_network.this: Refreshing state...
data.vra_region.this: Refreshing state...
vra_block_device.disk1: Creating...
vra_block_device.disk2: Creating...
vra_block_device.disk1: Still creating... [10s elapsed]
vra_block_device.disk2: Still creating... [10s elapsed]
vra_block_device.disk1: Still creating... [20s elapsed]
vra_block_device.disk2: Still creating... [20s elapsed]
vra_block_device.disk1: Creation complete after 20s [id=bfab3223-0497-4545-b69d-ff9ecb2851d9]
vra_block_device.disk2: Creation complete after 20s [id=fa1fb330-5d5b-40f9-9608-6836ca2eda2b]
vra_machine.this: Creating...
vra_machine.this: Still creating... [10s elapsed]
vra_machine.this: Still creating... [20s elapsed]
vra_machine.this: Still creating... [30s elapsed]
vra_machine.this: Still creating... [40s elapsed]
vra_machine.this: Still creating... [50s elapsed]
vra_machine.this: Still creating... [1m0s elapsed]
vra_machine.this: Still creating... [1m10s elapsed]
vra_machine.this: Still creating... [1m20s elapsed]
vra_machine.this: Still creating... [1m30s elapsed]
vra_machine.this: Still creating... [1m40s elapsed]
vra_machine.this: Still creating... [1m50s elapsed]
vra_machine.this: Still creating... [2m0s elapsed]
vra_machine.this: Still creating... [2m10s elapsed]
vra_machine.this: Still creating... [2m20s elapsed]
vra_machine.this: Still creating... [2m30s elapsed]
vra_machine.this: Still creating... [2m40s elapsed]
vra_machine.this: Still creating... [2m50s elapsed]
vra_machine.this: Still creating... [3m0s elapsed]
vra_machine.this: Creation complete after 3m2s [id=54afa0b8-8a97-4c10-9376-4a9e285fdec3]

Apply complete! Resources: 3 added, 0 changed, 0 destroyed.

And as expected we see 3 Deployments, two FCDs disks attached to a vSphere VM, indicating that all those resources can be managed independently.

 

 

Inspecting the VM at vSphere level, we would confirm that our two 10 GB FCD Disks were deployed and attached

Conclusion

Any Terraform Provider could be as good as the number or resources it exposes for management and the VMware’s Terraform Provider for vRealize Automation continues enhancing the existing capabilities and consistently adding more resources and data points that takes advantage of the exciting vRealize Automation capabilities.

The Terraform configuration samples can be found at moffzilla/vra-fcd

and more about vRealize Automation Terraform capabilities.

Terraform Provider for vRealize Automation Cloud

Terraform Service in vRealize Automation Cloud

vRealize Automation & Terraform : Cloud Automation Essentials – Part 1