Skip to content

Latest commit



83 lines (54 loc) · 4.97 KB

File metadata and controls

83 lines (54 loc) · 4.97 KB

This example Terraform code will use a community provider, adeleporte/hcx, to configure an HCX site pairing, service mesh, and related components between an on-prem data center and a Google Cloud VMware Engine (GCVE) SDDC. To use this example you should have an existing GCVE cluster, and a Terraform environment that is configured to work with your GCP project, and HCX installed on-prem.

You can find more information about this example here:


This Terraform code will do the following:

  • Create a Site Pairing in HCX between your on-prem data center and your GCVE SDDC
  • Create Network Profiles for management and vMotion networks
  • Create a Compute Profile
  • Create a Service Mesh using the Site Pairing, Network Profiles, and Compute Profiles
  • Extend a network from on-prem to GCVE using HCX Network Extension

After configuration is completed by Terraform, you will be able to use HCX to migrate Virtual Machines from your on-prem data center to GCVE. You can use PowerCLI or the HCX API to automate VM migrations.


This tutorial uses billable components of Google Cloud, including the following:

Use the pricing calculator to generate a cost estimate based on your projected usage.

Before you begin

This tutorial assumes that you have a basic understanding of Terraform, GCP, and GCVE, and that you have already deployed a GCVE environment.


To use this example, you will need to provide values for a few variables, and you will need to update with accurate values for your environment.

Variables Used

  • hcx_admin_username: Username for on-prem HCX appliance management. Default value is admin.
  • hcx_admin_password: Password for on-prem HCX appliance management
  • hcx_username: Username for on-prem HCX instance
  • hcx_password: Password for on-prem HCX instance
  • gcve_hcx_username: Username for GCVE HCX instance. Default value is CloudOwner@gve.local
  • gcve_hcx_password: Password for GCVE HCX instance

Using Envrironment Variables

You can use the following commands on MacOS or Linux to provide these variable values via environment variables. This is a good practice when passing credentials to Terraform.

export TF_VAR_hcx_admin_username='admin'
export TF_VAR_hcx_admin_password='password'
export TF_VAR_hcx_username=''
export TF_VAR_hcx_password='password'
export TF_VAR_gcve_hcx_username='CloudOwner@gve.local'
export TF_VAR_gcve_hcx_password='password'

You can use the unset commmand to remove set environment variables, if necessary.

Initialize and Run Terraform

Once your variables are set, and you have modified the values in to match your environment, follow the steps below to initialize and run Terraform.

  1. Run terraform init and ensure no errors are displayed
  2. Run terraform plan and review the changes that Terraform will perform
  3. Run terraform apply to apply the proposed configuration changes

Cleaning up

To remove the resources created by this example, run terraform destroy and answer yes when prompted to continue. This will only remove the service mesh and related configuration created by Terraform. Your GCVE environment will have to be deleted using these instructions, if desired.


This example is based on a community Terraform provider, and is not officially support by VMware. This provider is under active development and it is possible that you may hit a bug. Think carefully before using any content in this example in an enterprise environment before performing extensive testing. If you do hit a bug, or would like to contribute code to this provider, cruise over to the GitHub repo.

Helpful Links