Skip to main content
Terraform Modules to Deploy Equinix Fabric Solutions
  • Labs / 
  • Terraform Modules...

Terraform Modules to Deploy Equinix Fabric Solutions

Learn how to provision various Equinix Fabric solutions using Terraform modules and examples.

Version v0.14.0 was released on 21 October, 2024 View changelog External link icon

What is it?

If you're keen on streamlining your Equinix Fabric setups with Terraform, these Terraform modules and examples will give you a head start provisioning various Cloud Service Provider (CSP) interconnection solutions. These modules take advantage of the Equinix Terraform Provider and the providers of other CSPs to minimize and demonstrate the configuration needed to establish the most common links.

When you are ready to customize these examples and modules, be sure to check out the Equinix Fabric Developer Documentation for the fine details on Equinix Fabric's features and API details.

Why do we love it?

  • Comprehensive Resource Coverage: The modules cover a wide range of use cases, making it easier to deploy and manage complex network configurations with Equinix Fabric
  • Modularity and Flexibility: Each module can be used independently, allowing for flexible integration into existing Terraform workflows
  • Automation and Efficiency: By leveraging these Terraform modules, you can automate the deployment of Equinix Fabric resources, reducing or eliminating manual configuration complexity

How do you use it?

To learn more about the various connectivity solutions and how to deploy them using Terraform, start by exploring the Equinix Fabric Modules on the Terraform Registry.

Modules and Examples

The repository contains multiple independent modules, each with its own Terraform source code and a README.md file detailing the module’s specific usage. These modules cover Equinix Fabric features in diverse connectivity scenarios, ranging from cloud routers to virtual devices.

Equinix FCR to AWS

This example demonstrates how to establish a connection between Equinix Fabric Cloud Router (FCR) and AWS. The configuration involves setting up providers for both Equinix and AWS, and then using a module to create the connection. Ensure you have the necessary credentials and region information for both providers before proceeding.

provider "equinix" {
  client_id     = var.equinix_client_id
  client_secret = var.equinix_client_secret
}
provider "aws" {
  access_key = var.additional_info[0]["value"]
  secret_key = var.additional_info[1]["value"]
  region     = var.zside_seller_region
}
module "cloud_router_aws_connection" {
  source = "equinix/fabric/equinix//modules/cloud-router-connection"

  connection_name       = var.connection_name
  connection_type       = var.connection_type
  notifications_type    = var.notifications_type
  notifications_emails  = var.notifications_emails
  additional_info       = var.additional_info
  bandwidth             = var.bandwidth
  purchase_order_number = var.purchase_order_number

  #Aside
  aside_fcr_uuid = var.aside_fcr_uuid

  #Zside
  zside_ap_type               = var.zside_ap_type
  zside_ap_authentication_key = var.zside_ap_authentication_key
  zside_ap_profile_type       = var.zside_ap_profile_type
  zside_location              = var.zside_location
  zside_seller_region         = var.zside_seller_region
  zside_fabric_sp_name        = var.zside_fabric_sp_name
}

data "aws_dx_connection" "aws_connection" {
  depends_on = [
    module.cloud_router_aws_connection
  ]
  name = var.connection_name
}

resource "aws_dx_gateway" "aws_gateway" {
  depends_on = [
    module.cloud_router_aws_connection
  ]
  name            = var.aws_gateway_name
  amazon_side_asn = var.aws_gateway_asn
}

resource "aws_dx_private_virtual_interface" "aws_virtual_interface" {
  depends_on = [
    module.cloud_router_aws_connection,
    aws_dx_gateway.aws_gateway
  ]
  connection_id    = data.aws_dx_connection.aws_connection.id
  name             = var.aws_vif_name
  vlan             = data.aws_dx_connection.aws_connection.vlan_id
  address_family   = var.aws_vif_address_family
  bgp_asn          = var.aws_vif_bgp_asn
  amazon_address   = var.aws_vif_amazon_address
  customer_address = var.aws_vif_customer_address
  bgp_auth_key     = var.aws_vif_bgp_auth_key
  dx_gateway_id    = aws_dx_gateway.aws_gateway.id
}

Equinix Port to AWS

A small showcase of what you may find is how to create a Fabric Connection from an Equinix Port to AWS leveraging the port-connection module. It also leverages the AWS provider to create an AWS Direct Connect Gateway and an AWS Direct Connect Private Virtual Interface on that gateway:

provider "equinix" {
  client_id     = var.equinix_client_id
  client_secret = var.equinix_client_secret
}
provider "aws" {
  access_key = var.additional_info[0]["value"]
  secret_key = var.additional_info[1]["value"]
  region     = var.zside_seller_region
}
module "port_2_aws_connection" {
  source = "equinix/fabric/equinix//modules/port-connection"

  connection_name       = var.connection_name
  connection_type       = var.connection_type
  notifications_type    = var.notifications_type
  notifications_emails  = var.notifications_emails
  bandwidth             = var.bandwidth
  purchase_order_number = var.purchase_order_number
  additional_info       = var.additional_info

  # A-side
  aside_port_name = var.aside_port_name
  aside_vlan_tag  = var.aside_vlan_tag

  # Z-side
  zside_ap_type               = var.zside_ap_type
  zside_ap_authentication_key = var.zside_ap_authentication_key
  zside_ap_profile_type       = var.zside_ap_profile_type
  zside_location              = var.zside_location
  zside_seller_region         = var.zside_seller_region
  zside_sp_name               = var.zside_sp_name
}

data "aws_dx_connection" "aws_connection" {
  depends_on = [
    module.port_2_aws_connection
  ]
  name = var.connection_name
}

resource "aws_dx_gateway" "aws_gateway" {
  depends_on = [
    module.port_2_aws_connection
  ]
  name            = var.aws_gateway_name
  amazon_side_asn = var.aws_gateway_asn
}

resource "aws_dx_private_virtual_interface" "aws_virtual_interface" {
  depends_on = [
    module.port_2_aws_connection,
    aws_dx_gateway.aws_gateway
  ]
  connection_id    = data.aws_dx_connection.aws_connection.id
  name             = var.aws_vif_name
  vlan             = data.aws_dx_connection.aws_connection.vlan_id
  address_family   = var.aws_vif_address_family
  bgp_asn          = var.aws_vif_bgp_asn
  amazon_address   = var.aws_vif_amazon_address
  customer_address = var.aws_vif_customer_address
  bgp_auth_key     = var.aws_vif_bgp_auth_key
  dx_gateway_id    = aws_dx_gateway.aws_gateway.id
}

More Examples

These are just a few examples among many that you'll find in the Equinix Fabric Module.

Dive into specific examples to understand detailed use cases and get hands-on experience with the Equinix Fabric Terraform:

Looking for more

Share your experiences and feedback with the community on the Equinix Community.

Interested in other Terraform Modules? Let us know about the Equinix Labs' Terraform modules you would like to see.

Last updated

07 November, 2024

Category

Type

Integrations