跳至内容

通过 Terraform 连接到 Equinix Fabric 云平台

-> **注意:**请参阅[Equinix Fabric 更多详情请参阅文档。

Equinix Fabric™ 是一种软件定义的互连服务,允许任何企业连接 将其自身的分布式基础设施连接到任何其他公司的基础设施或服务提供商 在全球互联的网络中使用 Equinix® 平台。本指南主要侧重于建立…… 与云服务提供商的互连以及如何利用 Equinix Fabric 连接 Terraform 模块 更多详情及其他选项,请查看下方的参考资料部分。

入门指南 - 实现互联

无论您是在搭建多云架构还是混合云架构,您都将使用的主要资源是…… 需要定义的是 equinix_fabric_connection, 将允许 Equinix 代表您启用与指定云提供商的互连。 但是,还需要在 Equinix 和您的云端配置其他一些必需资源。 供应商需要确保互联互通正常运行。下面我们将使用以下方式描述这些一般步骤。 以 Azure ExpressRoute 为例。

1. 在云提供商中启用互连 - 通常这意味着创建一个云路由器 以及互连资产(例如 Google Cloud Router 和 VLAN 连接、Oracle FastConnect、 等等)。本示例需要一个 azurerm_express_route_circuit。 资源中必须指定服务提供商(即Equinix)才能生成 有效的配对密钥。

provider "azurerm" {
features {}
}

resource "azurerm_express_route_circuit" "example" {
name = "my-circuit"
resource_group_name = "my-resource-group"
location = "Germany West Central"
service_provider_name = "Equinix"
peering_location = "Frankfurt"
bandwidth_in_mbps = 100
sku {
tier = "Premium"
family = "UnlimitedData"
}
allow_classic_operations = false
}

2. 请求 Equinix Fabric 连接 - 来自 Equinix Fabric 端口 / 网络边缘设备 / Equinix 服务令牌 / Equinix Fabric 云路由器 到云端虚拟互连资产。

在这个例子中,我们将建立从云路由器到路由器的连接。 资源)。请注意,authorization_key 的值必须是 azurerm_express_route_circuit.example.service_key。 (即上面提到的配对密钥)。

provider "equinix" {}

data "equinix_fabric_service_profile" "azure" {
name = "Azure ExpressRoute"
filter {
property = "/name"
operator = "="
values = ["Azure ExpressRoute"]
}
}

resource "equinix_fabric_connection" "fcr2azure"{
name = "ConnectionName"
type = "IP_VC"
notifications{
type = "ALL"
emails = ["example@equinix.com","test1@equinix.com"]
}
bandwidth = azurerm_express_route_circuit.example.bandwidth_in_mbps
order {
purchase_order_number = "1-323292"
}
a_side {
access_point {
type = "CLOUD_ROUTER"
router {
uuid = "<cloud_router_uuid>"
}
}
}
z_side {
access_point {
type = "SP"
authentication_key = azurerm_express_route_circuit.example.service_key
peering_type = "PRIVATE"
profile {
type = "L2_PROFILE"
uuid = data.equinix_fabric_service_profile.azure.data.0.id
}
location {
metro_code = "SV"
}
}
}
}

3. 在云侧配置 BGP - 也称为电路对等体或虚拟接口,所有云 提供商提供添加 BGP 对等体的资源。一些常见的必要信息如下: 提供的有:

  • 客户路由器 IP(云提供商应将数据发送到的目标路由器对等 IP) 交通)。
  • 云路由器 IP(用于向云端发送流量的虚拟路由器对等 IP)。
  • 客户 BGP ASN(您的本地对等体的边界网关协议自治系统编号) 路由器)。

在这个例子中,我们需要创建一个 azurerm_express_route_circuit_peering,其中包含详细信息。 必须定义主连接和辅助连接。

resource "azurerm_express_route_circuit_peering" "example" {
express_route_circuit_name = azurerm_express_route_circuit.example.name
resource_group_name = "my-resource-group"

peering_type = "AzurePrivatePeering"
peer_asn = 100
primary_peer_address_prefix = "123.0.0.0/30"
secondary_peer_address_prefix = "123.0.0.4/30"
vlan_id = 300
bandwidth_in_mpbs = 50
}

4. 在 Equinix 端配置 BGP - 最后,客户端也必须配置相同的 BGP。 信息。由于本例中连接的源头是 Fabric 云路由器,因此您可以 利用 equinix_fabric_routing_protocol 资源在云端配置 BGP 对等连接。 路由器。

resource "equinix_fabric_routing_protocol" "direct"{
connection_uuid = equinix_fabric_connection.fcr2azure.id
type = "DIRECT"
name = "direct_rp"
direct_ipv4 {
equinix_iface_ip = "190.1.1.1/30"
}
direct_ipv6{
equinix_iface_ip = "190::1:1/126"
}
}

resource "equinix_fabric_routing_protocol" "bgp" {
depends_on = [
equinix_fabric_routing_protocol.direct
]
connection_uuid = equinix_fabric_connection.fcr2azure.id
type = "BGP"
name = "bgp_rp"
bgp_ipv4 {
customer_peer_ip = "190.1.1.2"
enabled = true
}
bgp_ipv6 {
customer_peer_ip = "190::1:2"
enabled = true
}
customer_asn = 4532
}

Terraform 模块——最简单的方法

尽管 Equinix 端的配置看起来类似,但所需的所有资源 完成配置的具体步骤取决于各个云服务提供商。这需要您事先具备相关知识。 了解如何在每个平台上配置互连。或者,您可以采取 Equinix Fabric Terraform 模块 的优势。

Terraform 模块将配置中一起使用的多个资源容器化。 使用 Equinix Fabric Terraform Cloud Router 2 Azure 连接示例模块 以及 Equinix Fabric Terraform 路由协议模块 您只需定义三个资源即可配置上述所有内容。

以下代码足以完全替换上面的示例:

# main.tf
provider "equinix" {}

provider "azurerm" {}

module "equinix-fabric-connection-azure" {
source = "equinix/fabric/equinix//examples/cloud-router-2-azure-connection"


# Connection Details
connection_name = "fcr_2_azure"
connection_type = "IP_VC"
notifications_type = "ALL"
notifications_emails = ["example@equinix.com","test1@equinix.com"]
purchase_order_number = "1-323292"
bandwidth = 50
aside_ap_type = "CLOUD_ROUTER"
aside_fcr_uuid = "<Primary Fabric Cloud router UUID>"
zside_ap_type = "SP"
zside_ap_profile_type = "L2_PROFILE"
zside_location = "SV"
zside_peering_type = "PRIVATE"
zside_fabric_sp_name = "Azure ExpressRoute"

# Azure details
azure_client_id = "<Azure Client Id>"
azure_client_secret = "<Azure Client Secret Value>"
azure_tenant_id = "<Azure Tenant Id>"
azure_subscription_id = "<Azure Subscription Id>"
azure_resource_name = "my-resource-group"
azure_location = "West US 2"
azure_service_key_name = "Test_Azure_Key"
azure_service_provider_name = "<Service Provider Name>"
azure_peering_location = "Silicon Valley Test"
azure_tier = "Standard"
azure_family = "UnlimitedData"
azure_environment = "PROD"
}

resource "azurerm_express_route_circuit_peering" "example" {
express_route_circuit_name = module.equinix-fabric-connection-azure.azurerm_express_route_circuit_name
resource_group_name = "my-resource-group"

peering_type = "AzurePrivatePeering"
peer_asn = 100
primary_peer_address_prefix = "123.0.0.0/30"
secondary_peer_address_prefix = "123.0.0.4/30"
vlan_id = 300
bandwidth_in_mpbs = 50
}

module "routing_protocols" {
source = "equinix/fabric/equinix//modules/routing-protocols"

connection_uuid = module.equinix-fabric-connection-azure.module_output

# Direct RP Details
direct_rp_name = "direct_rp"
direct_equinix_ipv4_ip = "190.1.1.1/30"
direct_equinix_ipv6_ip = "190::1:1/126"

# BGP RP Details
bgp_rp_name = "bgp_rp"
bgp_customer_asn = 4532
bgp_customer_peer_ipv4 = "190.1.1.2"
bgp_enabled_ipv4 = true
bgp_customer_peer_ipv6 = var.bgp_customer_peer_ipv6
bgp_enabled_ipv6 = "190::1:2"
}

如果您找不到适用于您的云服务提供商的版本,您可以在github 仓库中提交工单。 满足您的要求。

参考

  • 请参阅API 使用指南了解更多信息 详细说明各云服务提供商的要求。
  • 查看可用提供商 在 Equinix® 平台上查找您所需的服务提供商。
此页面有帮助吗?