Skip to content

Commit

Permalink
support for bgp configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
ocobles committed Mar 29, 2022
1 parent 9678d80 commit bb475c3
Show file tree
Hide file tree
Showing 17 changed files with 414 additions and 69 deletions.
45 changes: 28 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,21 @@

As part of Platform Equinix, your infrastructure can connect with other parties, such as public cloud providers, network service providers, or your own colocation cages in Equinix by defining an [Equinix Fabric - software-defined interconnection](https://docs.equinix.com/en-us/Content/Interconnection/Fabric/Fabric-landing-main.htm).

This module creates a Cloud router or uses an existing one, an InterconnectAttachment in Google Cloud, and the l2 connection in Equinix Fabric using the InterconnectAttachment pairing key.
This module creates a Cloud router or uses an existing one, an InterconnectAttachment in Google Cloud, and the l2 connection in Equinix Fabric using the InterconnectAttachment pairing key. BGP can be optionally configured in both sides if Network Edge device is used.

```html
Origin Destination
(A-side) (Z-side)

┌────────────────┐
│ Equinix Fabric │ Equinix Fabric ┌────────────────────┐ ┌───────────────────────┐
│ Port / Network ├───── l2 connection ───────►│ GCP │──────►│ Clour Router ─► VPC │
│ Edge Device / │ (50 Mbps - 10 Gbps) │ Interconnect │ │ │
│ Service Token │ └────────────────────┘ └───────────────────────┘
└────────────────┘
│ Equinix Fabric │ Equinix Fabric ┌────────────────────┐ ┌────────────────┐
│ Port / Network ├───── l2 connection ───────►│ GCP │──────►│ Clour Router │
│ Edge Device / │ (50 Mbps - 10 Gbps) │ Interconnect │ │ │
│ Service Token │ └────────────────────┘ └────────────────┘
└────────────────┘ │
│ │
└ - - - - - - - - - - Network Edge Device - - - - - - - - - - - - - - - - - ┘
BGP peering
```

### Usage
Expand Down Expand Up @@ -60,24 +63,32 @@ module "equinix-fabric-connection-gcp" {

Run `terraform init -upgrade` and `terraform apply`.

#### Resources
-> **NOTE:**
Completing BGP configuration in GCP side is not directly supported with current google terraform provider (v3.72.0). As a workaround this module take advantage of [terraform-google-gcloud](https://registry.terraform.io/modules/terraform-google-modules/gcloud/google/latest) module which allows use gcloud. However, it is only available for `linux` and `darwin` based operating systems. To run this module in a non-supported platfom, 'network_edge_configure_bgp' and 'gcp_configure_bgp' must remain false. Check this [issue](https://github.com/hashicorp/terraform-provider-google/issues/9582) to obtain further information.

### Variables

See <https://registry.terraform.io/modules/equinix-labs/fabric-connection-gcp/equinix/latest?tab=inputs> for a description of all variables.

### Outputs

See <https://registry.terraform.io/modules/equinix-labs/fabric-connection-gcp/equinix/latest?tab=outputs> for a description of all outputs.

### Resources

| Name | Type |
| :-----: | :------: |
|------|------|
| [random_string.this](https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/string) | resource |
| [equinix-fabric-connection](https://registry.terraform.io/modules/equinix-labs/fabric-connection/equinix/latest?tab=inputs) | module |
| [equinix_network_bgp.this](https://registry.terraform.io/providers/equinix/equinix/latest/docs/resources/equinix_network_bgp) | resource |
| [google_compute_interconnect_attachment.this](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/compute_interconnect_attachment) | resource |
| [google_compute_router.this](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/compute_router) | resource |
| [google_compute_router.this](https://registry.terraform.io/providers/hashicorp/google/latest/docs/data-sources/compute_router) | data source |

#### Variables

See <https://registry.terraform.io/modules/equinix-labs/fabric-connection-gcp/equinix/latest?tab=inputs> for a description of all variables.

#### Outputs

See <https://registry.terraform.io/modules/equinix-labs/fabric-connection-gcp/equinix/latest?tab=outputs> for a description of all outputs.
| [gcloud-configure-bgp](https://registry.terraform.io/modules/terraform-google-modules/gcloud/google/latest) | module |
| [gcloud-get-bgp-addresses](https://registry.terraform.io/modules/terraform-google-modules/gcloud/google/latest) | module |
| [local_file.this](https://registry.terraform.io/providers/hashicorp/local/latest/docs/data-sources/file) | data source |

### Examples

- [examples/simple](examples/simple/)
- [Fabric Port connection example](https://registry.terraform.io/modules/equinix-labs/fabric-connection-gcp/equinix/latest/examples/fabric-port-connection/)
- [Network Edge device connection](https://registry.terraform.io/modules/equinix-labs/fabric-connection-gcp/equinix/latest/examples/network-edge-device-connection/)
30 changes: 30 additions & 0 deletions examples/fabric-port-connection/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Fabric Port Connection Example

This example demonstrates usage of the Equinix Connection module to establish a non-redundant Equinix Fabric L2 Connection from a Equinix Fabric port to Google Cloud Interconnect. It will:

- Use VPC 'default'
- Use project specified in provider
- Create a Google Cloud Router
- Create a Google Cloud Interconnect/VLAN Attachment
- Create an Equinix Fabric l2 connection with minimun available bandwidth for Google Cloud service profile

## Usage

To provision this example, you should clone the github repository and run terraform from within this directory:

```bash
git clone https://github.com/equinix-labs/terraform-equinix-fabric-connection-gcp.git
cd terraform-equinix-fabric-connection-gcp/examples/fabric-port-connection
terraform init
terraform apply
```

Note that this example may create resources which cost money. Run 'terraform destroy' when you don't need these resources.

## Variables

See <https://registry.terraform.io/modules/equinix-labs/fabric-connection-gcp/equinix/latest/examples/fabric-port-connection?tab=inputs> for a description of all variables.

## Outputs

See <https://registry.terraform.io/modules/equinix-labs/fabric-connection-gcp/equinix/latest/examples/fabric-port-connection?tab=outputs> for a description of all outputs.
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
provider "equinix" {}

provider "google" {
project = "example"
region = "europe-west3"
project = var.project_name
region = "europe-west3"
}

variable "port_name" {}

module "equinix-fabric-connection-gcp" {
source = "github.com/equinix-labs/terraform-equinix-fabric-connection-gcp"

Expand All @@ -18,7 +16,3 @@ module "equinix-fabric-connection-gcp" {
fabric_vlan_stag = 1010
fabric_destination_metro_code = "FR"
}

output "connection_details" {
value = module.equinix-fabric-connection-gcp
}
3 changes: 3 additions & 0 deletions examples/fabric-port-connection/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
output "connection_details" {
value = module.equinix-fabric-connection-gcp
}
12 changes: 12 additions & 0 deletions examples/fabric-port-connection/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
variable "project_name" {
type = string
description = "The default GCP project to manage resources in."
}

variable "port_name" {
type = string
description = <<EOF
Name of the [Equinix Fabric port](https://docs.equinix.com/en-us/Content/Interconnection/Fabric/ports/Fabric-port-details.htm)
from which the connection would originate.
EOF
}
File renamed without changes.
31 changes: 31 additions & 0 deletions examples/network-edge-device-connection/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Network Edge Device Connection Example

This example demonstrates usage of the Equinix Connection module to establish a non-redundant Equinix Fabric L2 Connection from a Equinix Network Edge device to Google Cloud Interconnect. It will:

- Use 'default' VPC
- Use the `project` specified in provider
- Create a Google Cloud Router
- Create a Google Cloud Interconnect/VLAN Attachment
- Create Equinix Fabric l2 connection with 200 Mbps bandwidth
- Configure BGP session between the GCP cloud router and your Network Edge device

## Usage

To provision this example, you should clone the github repository and run terraform from within this directory:

```bash
git clone https://github.com/equinix-labs/terraform-equinix-fabric-connection-gcp.git
cd terraform-equinix-fabric-connection-gcp/examples/network-edge-device-connection
terraform init
terraform apply
```

Note that this example may create resources which cost money. Run 'terraform destroy' when you don't need these resources.

## Variables

See <https://registry.terraform.io/modules/equinix-labs/fabric-connection-gcp/equinix/latest/examples/network-edge-device-connection?tab=inputs> for a description of all variables.

## Outputs

See <https://registry.terraform.io/modules/equinix-labs/fabric-connection-gcp/equinix/latest/examples/network-edge-device-connection?tab=outputs> for a description of all outputs.
23 changes: 23 additions & 0 deletions examples/network-edge-device-connection/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
provider "equinix" {}

provider "google" {
project = var.project_name
region = "europe-west3"
}

module "equinix-fabric-connection-gcp" {
source = "github.com/equinix-labs/terraform-equinix-fabric-connection-gcp"

# required variables
fabric_notification_users = ["[email protected]"]

# optional variables
network_edge_device_id = var.device_id
network_edge_configure_bgp = true

fabric_destination_metro_code = "FR"
fabric_speed = 200

platform = "darwin"
gcp_gcloud_skip_download = true
}
30 changes: 30 additions & 0 deletions examples/network-edge-device-connection/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
output "fabric_connection_id" {
value = module.equinix-fabric-connection-gcp.fabric_connection_uuid
}

output "fabric_connection_name" {
value = module.equinix-fabric-connection-gcp.fabric_connection_name
}

output "fabric_connection_status" {
value = module.equinix-fabric-connection-gcp.fabric_connection_status
}

output "fabric_connection_provider_status" {
value = module.equinix-fabric-connection-gcp.fabric_connection_provider_status
}

output "network_edge_bgp_provisioning_status" {
description = "Network Edge device BGP peering configuration provisioning status."
value = module.equinix-fabric-connection-gcp.network_edge_bgp_provisioning_status
}

output "gcp_interconnect_id" {
description = "Google Cloud Interconnect/VLAN attachment ID."
value = module.equinix-fabric-connection-gcp.gcp_interconnect_id
}

output "gcp_cloud_router_id" {
description = "Google Cloud Router ID."
value = module.equinix-fabric-connection-gcp.gcp_cloud_router_id
}
12 changes: 12 additions & 0 deletions examples/network-edge-device-connection/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
variable "project_name" {
type = string
description = "The default GCP project to manage resources in."
}

variable "device_id" {
type = string
description = <<EOF
The ID of the (Network Edge virtual device](https://github.com/equinix/terraform-provider-equinix/tree/master/examples/edge-networking)
from which the connection would originate.
EOF
}
14 changes: 14 additions & 0 deletions examples/network-edge-device-connection/versions.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
terraform {
required_version = ">= 0.13"

required_providers {
equinix = {
source = "equinix/equinix"
version = ">= 1.5.0"
}
google = {
source = "hashicorp/google"
version = ">= 3.72.0"
}
}
}
16 changes: 0 additions & 16 deletions examples/simple/README.md

This file was deleted.

Loading

0 comments on commit bb475c3

Please sign in to comment.