Peering Connections
You can create a peering connection between HashiCorp Cloud Platform (HCP) and your virtual network (VNet) in Azure to link resources between the two services.
Overview
The Consul servers hosted on HCP use peering connections to communicate with the clients hosted in your Azure environment.
You can create peering connections from the HCP interface. You can also use the HCP provider in Terraform. For instructions on how to create peering connections with Terraform, refer to the HCP provider documentation.
You can use peering connections to quickly connect the HVN to your VNet. You can also create HVN peering connections across different Azure regions. However, peering connections may not scale to meet the requirements of complex environments.
Tutorial: For step-by-step guidance on creating peering connections, refer to the Peering an Azure Virtual Network with HashiCorp Cloud Platform tutorial.
Requirements
- An Azure account ID
- The ID of the VNet you wish to connect
- VNets must be configured with RFC1918 IP addresses.
Create Peering Connections
To set up a peering connection, you need to configure the connection request in HCP and then configure a corresponding request in Azure.
Configure the Connection Request in HCP
- Sign in to the HCP Portal and select your organization.
- From the sidebar, click HashiCorp Virtual Network.
- Click on an HVN in the ID column.
- From the sidebar, click Peering connections.
- Click Create connection.
- Complete the requested fields. In the Connection ID field, enter a name for the peering connection. The name can be up to 36 characters and can only include letters, numbers, and dashes. Then, enter your Azure Tenant ID, Azure Subscription ID, Resource group name, and Azure VNet name.
- Click Create connection.
The HVN sends a peering connection request to Azure. The peering request expires after seven days. The status of the connection appears as pending until either the connection process is completed or the request expires.
Accept the Connection Request in Azure
HCP generates terminal commands that you can copy and paste into your Azure CLI to configure the corresponding connection request. HCP also provides links to the Azure documentation if you prefer to use the Azure browser interface.
- Sign in to the HCP Portal and select your organization.
- From the sidebar, click HashiCorp Virtual Network.
- Click on an HVN in the ID column.
- From the sidebar, click Peering connections.
- Click the name of the connection in the ID column.
- Under “Peering Instructions,” click the tab for Azure Cloud Shell.
- Follow the instructions to run the sequence of commands.
You can also create the second request from the Azure console. For information about creating VNet peering connections, refer to the Azure documentation.
Next Steps
The HVN peering connection does not contain routing information. Once the connection is active, you can add a route for all or part of the VNet CIDR range. For more details, refer to Routes.