Skip to content

Commit

Permalink
Add AWS and GCP Fabric Cloud Router connections (#375)
Browse files Browse the repository at this point in the history
Adds the below Fabric cloud router(FCR) connections types and related
tests and examples

- FCR to AWS
- FCR to GCP
  • Loading branch information
ctreatma authored Sep 7, 2023
2 parents 5cf6d50 + 91c17ab commit 4825cd2
Show file tree
Hide file tree
Showing 28 changed files with 365 additions and 29 deletions.
2 changes: 1 addition & 1 deletion docs/resources/equinix_fabric_cloud_router.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ API documentation can be found here - https://developer.equinix.com/dev-docs/fab
- `name` (String) Fabric Cloud Router name. An alpha-numeric 24 characters string which can include only hyphens and underscores
- `notifications` (Block List, Min: 1) Preferences for notifications on Fabric Cloud Router configuration or status changes (see [below for nested schema](#nestedblock--notifications))
- `package` (Block Set, Min: 1, Max: 1) Fabric Cloud Router package (see [below for nested schema](#nestedblock--package))
- `type` (String) Defines the FG type like XF_GATEWAY
- `type` (String) Defines the FCR type like XF_GATEWAY

### Optional

Expand Down
2 changes: 1 addition & 1 deletion equinix/fabric_cloud_router_schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ func createCloudRouterResourceSchema() map[string]*schema.Schema {
Type: schema.TypeString,
Required: true,
ValidateFunc: validation.StringInSlice([]string{"XF_ROUTER"}, true),
Description: "Defines the FG type like XF_ROUTER",
Description: "Defines the FCR type like XF_ROUTER",
},
"location": {
Type: schema.TypeSet,
Expand Down
File renamed without changes.
File renamed without changes.
7 changes: 7 additions & 0 deletions examples/fabric/v4/cloudRouter/terraform.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
terraform {
required_providers {
equinix = {
source = "equinix/equinix"
}
}
}
File renamed without changes.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# ECX Fabric Layer2 Connection from fabric cloud router to AWS

This example shows how create connection from Fabric Cloud Router to AWS, on ECX Fabric ports.

## Adjust variables
At minimum, you must set below variables in `terraform.tfvars` file:

* `equinix_client_id` - Equinix client ID (consumer key), obtained after
registering app in the developer platform
* `equinix_client_secret` - Equinix client secret ID (consumer secret),
obtained same way as above

`fcr_uuid` - UUID of ECX Fabric Cloud Router on a-side
`zside_port_name` - Name of ECX Fabric z-side port , i.e. ops-user100-CX-SV5-NL-Qinq-BO-10G-SEC-JP-000
`connection_name` - the name of the connection
`connection_type` - connection type, please refer schema
`notifications_type` - notification type
`notifications_emails` - List of emails
`bandwidth` - bandwidth in MBs
`redundancy` - Port redundancy
`aside_ap_type` - Fabric Cloud Router type
`zside_ap_type` - Z side access point type
`zside_ap_authentication_key` - AWS authorization key, account number like 357848912121
`zside_ap_profile_type` - Service profile type
`fabric_sp_name` - Service profile name, fetched based on Service Profile get call using Service Profile search schema
`zside_location` - Seller location
`seller_region` - Seller region code

## AWS login

Log in to AWS portal use account that has permission to create necessary resources.

## Initialize
- First step is to initialize the terraform directory/resource we are going to work on.
In the given example, the folder to perform CRUD operations on a fcr2port connection can be found at examples/fcr2port/.

- Change directory into - `CD fcr2aws/`
- Initialize Terraform plugins - `terraform init`

## Fabric Cloud Router to port connection : Create, Read, Update and Delete(CRUD) operations
Note: `–auto-approve` command does not prompt the user for validating the applying config. Remove it to get a prompt to confirm the operation.

| Operation | Command | Description |
|:----------|:---------------------------------:|-----------------------------------------------------------------------:|
| CREATE | `terraform apply –auto-approve` | Creates a fcr2port connection resource |
| READ | `terraform show` | Reads/Shows the current state of the fcr2port connection resource |
| UPDATE | `terraform apply -refresh` | Updates the fcr2port with values provided in the terraform.tfvars file |
| DELETE | `terraform destroy –auto-approve` | Deletes the created fcr2port connection resource |
54 changes: 54 additions & 0 deletions examples/fabric/v4/cloudRouterConnectivity/cloudRouter2aws/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
provider "equinix" {
client_id = var.equinix_client_id
client_secret = var.equinix_client_secret
}
data "equinix_fabric_service_profiles" "aws" {
filter {
property = "/name"
operator = "="
values = [var.fabric_sp_name]
}
}


resource "equinix_fabric_connection" "fcr2aws"{
name = var.connection_name
type = var.connection_type
notifications{
type=var.notifications_type
emails=var.notifications_emails
}
bandwidth = var.bandwidth
redundancy {priority= var.redundancy}

order {
purchase_order_number= var.purchase_order_number
}
a_side {
access_point {
type= var.aside_ap_type
router {
uuid= var.fcr_uuid
}
}
}
z_side {
access_point {
type= var.zside_ap_type
authentication_key= var.zside_ap_authentication_key
seller_region = var.seller_region
profile {
type= var.zside_ap_profile_type
uuid= data.equinix_fabric_service_profiles.aws.data.0.uuid
}
location {
metro_code= var.zside_location
}
}
}
}

output "connection_result" {
value = equinix_fabric_connection.fcr2aws.id
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
terraform {
required_providers {
equinix = {
source = "equinix/equinix"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
equinix_client_id = ""
equinix_client_secret = ""

notifications_type = "ALL"
notifications_emails = ["[email protected]","[email protected]"]
purchase_order_number = "1-323292"
fcr_uuid = "3d8ec863-06b4-4887-9feb-ccacb82923d5"
connection_name = "terra_fcr2aws-2"
connection_type = "IP_VC"
bandwidth = 50
redundancy = "SECONDARY"
aside_ap_type = "CLOUD_ROUTER"

zside_ap_type = "SP"
zside_ap_authentication_key = ""
zside_ap_profile_type = "L2_PROFILE"
zside_location = "SV"
seller_region = "us-west-1"
fabric_sp_name = "AWS Direct Connect"
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
variable "equinix_client_id" {}
variable "equinix_client_secret" {}

variable "fcr_uuid" {}
variable "notifications_type" {}
variable "notifications_emails" {}
variable "purchase_order_number" {}

variable "connection_name" {}
variable "connection_type" {}
variable "bandwidth" {}
variable "redundancy" {}

variable "aside_ap_type" {}
variable "zside_ap_type" {}
variable "zside_ap_authentication_key" {}

variable "zside_ap_profile_type" {}
variable "fabric_sp_name" {}
variable "zside_location" {}
variable "seller_region" {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# ECX Fabric Layer2 Connection from fabric cloud router to google

This example shows how create connection from Fabric Cloud Router to google, on ECX Fabric ports.

## Adjust variables
At minimum, you must set below variables in `terraform.tfvars` file:

* `equinix_client_id` - Equinix client ID (consumer key), obtained after
registering app in the developer platform
* `equinix_client_secret` - Equinix client secret ID (consumer secret),
obtained same way as above

`fcr_uuid` - UUID of ECX Fabric Cloud Router on a-side
`zside_port_name` - Name of ECX Fabric z-side port , i.e. ops-user100-CX-SV5-NL-Qinq-BO-10G-SEC-JP-000
`connection_name` - the name of the connection
`connection_type` - connection type, please refer schema
`notifications_type` - notification type
`notifications_emails` - List of emails
`bandwidth` - bandwidth in MBs
`redundancy` - Port redundancy
`aside_ap_type` - Fabric Cloud Router type
`zside_ap_type` - Z side access point type
`zside_ap_authentication_key` - Google authorization key following a pattern, like **9da09fe8-a33b-4457-ab7d-d91f83152276/us-west1/1**
`zside_ap_profile_type` - Service profile type
`zside_location` - Seller location
`seller_region` - Seller region code

## Initialize
- First step is to initialize the terraform directory/resource we are going to work on.
In the given example, the folder to perform CRUD operations on a fcr2port connection can be found at examples/fcr2port/.

- Change directory into - `CD fcr2gcp/`
- Initialize Terraform plugins - `terraform init`

## Fabric Cloud Router to port connection : Create, Read, Update and Delete(CRUD) operations
Note: `–auto-approve` command does not prompt the user for validating the applying config. Remove it to get a prompt to confirm the operation.

| Operation | Command | Description |
|:----------|:---------------------------------:|-----------------------------------------------------------------------:|
| CREATE | `terraform apply –auto-approve` | Creates a fcr2port connection resource |
| READ | `terraform show` | Reads/Shows the current state of the fcr2port connection resource |
| UPDATE | `terraform apply -refresh` | Updates the fcr2port with values provided in the terraform.tfvars file |
| DELETE | `terraform destroy –auto-approve` | Deletes the created fcr2port connection resource |
56 changes: 56 additions & 0 deletions examples/fabric/v4/cloudRouterConnectivity/cloudRouter2gcp/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
provider "equinix" {
client_id = var.equinix_client_id
client_secret = var.equinix_client_secret
}

data "equinix_fabric_service_profiles" "gcp" {
filter {
property = "/name"
operator = "="
values = [var.fabric_sp_name]
}
}

resource "equinix_fabric_connection" "fcr2gcp"{
name = var.connection_name
type = var.connection_type
notifications{
type=var.notifications_type
emails=var.notifications_emails
}
bandwidth = var.bandwidth
redundancy {priority= var.redundancy}

order {
purchase_order_number= var.purchase_order_number
}
a_side {
access_point {
type= var.aside_ap_type
router {
uuid= var.fcr_uuid
}
}
}

z_side {
access_point {
type = var.zside_ap_type
authentication_key = var.zside_ap_authentication_key
seller_region = var.zside_seller_region
profile {
type = var.zside_ap_profile_type
uuid = data.equinix_fabric_service_profiles.gcp.data.0.uuid
}
location {
metro_code = var.zside_location
}
}
}

}

output "connection_result" {
value = equinix_fabric_connection.fcr2gcp.id
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
terraform {
required_providers {
equinix = {
source = "equinix/equinix"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
equinix_client_id = ""
equinix_client_secret = ""

notifications_type = "ALL"
notifications_emails = ["[email protected]","[email protected]"]
purchase_order_number = "1-323292"
fcr_uuid = "3d8ec863-06b4-4887-9feb-ccacb82923d5"
connection_name = "conn-terra_gcp2"
connection_type = "IP_VC"
bandwidth = 50
redundancy = "SECONDARY"
aside_ap_type = "CLOUD_ROUTER"

zside_ap_type = "SP"
zside_ap_authentication_key = "<gcp-key>/us-west1/2"
zside_ap_profile_type = "L2_PROFILE"
zside_location = "SV"
zside_seller_region="us-west1"
fabric_sp_name = "Google Cloud Partner Interconnect Zone 1"
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
variable "equinix_client_id" {}
variable "equinix_client_secret" {}

variable "fcr_uuid" {}
variable "notifications_type" {}
variable "notifications_emails" {}
variable "purchase_order_number" {}

variable "connection_name" {}
variable "connection_type" {}
variable "bandwidth" {}
variable "redundancy" {}

variable "aside_ap_type" {}
variable "zside_ap_type" {}
variable "zside_ap_authentication_key" {}

variable "zside_ap_profile_type" {}
variable "fabric_sp_name" {}
variable "zside_location" {}
variable "zside_seller_region" {}
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,6 @@ resource "equinix_fabric_connection" "fcr2port"{
}
}

output "fcr2port_result" {
output "connection_result" {
value = equinix_fabric_connection.fcr2port.id
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
terraform {
required_providers {
equinix = {
source="developer.equinix.com/terraform/equinix"
version = "9.0.0"
source = "equinix/equinix"
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# ECX Fabric Cloud Router Connection BGP CRUD operations
This example shows how to create Config BGP on FG connection .
This example shows how to create Config BGP on FCR connection .

Note: Each time you need to create a BGP resource add-on
make a copy of the base folder - examples/routing-protocol-bgp/ and CD into this folder to perform all the CRUD operations.
Expand All @@ -14,7 +14,7 @@ At minimum, you must set below variables in `terraform.tfvars` file:
- `rp_type`- Type of routing Protocol entity, "BGP"
- connection_uuid = "d557cb4c-9052-4298-b5ca-8a9ed914cf03"
rp_type = "DIRECT"
rp_name = "FG-RP"
rp_name = "FCR-RP"
customer_peer_ipv4 = "192.1.1.2"
customer_peer_ipv6 = "192::1:2"
customer_asn = "100"
Expand All @@ -31,7 +31,7 @@ Note: `–auto-approve` command does not prompt the user for validating the appl

| Operation | Command | Description |
|:----------|:---------------------------------:|--------------------------------------------------------------------------:|
| CREATE | `terraform apply –auto-approve` | Creates an FG resource |
| READ | `terraform show` | Reads/Shows the current state of the FG resource |
| UPDATE | `terraform apply -refresh` | Updates the FG resource with values provided in the terraform.tfvars file |
| DELETE | `terraform destroy –auto-approve` | Deletes the created FG resource |
| CREATE | `terraform apply –auto-approve` | Creates an FCR resource |
| READ | `terraform show` | Reads/Shows the current state of the FCR resource |
| UPDATE | `terraform apply -refresh` | Updates the FCR resource with values provided in the terraform.tfvars file |
| DELETE | `terraform destroy –auto-approve` | Deletes the created FCR resource |
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ equinix_client_secret = "MyEquinixSecret"

connection_uuid = "bfa41c64-3720-4cef-88dd-ec795ba36800"
rp_type = "BGP"
rp_name = "FG-Con-BGP"
rp_name = "FCR-Con-BGP"
customer_peer_ipv4 = "190.1.1.2"
customer_peer_ipv6 = "190::1:2"
customer_asn = "100"
Loading

0 comments on commit 4825cd2

Please sign in to comment.