Skip to content

Commit

Permalink
feat: Add Azure and Oracle Fabric Cloud Router connections (#382)
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 Azure cloud
- FCR to Oracle cloud

---------

Co-authored-by: srushti-patl <[email protected]>
Co-authored-by: Tim Hogarty <[email protected]>
  • Loading branch information
3 people authored Sep 19, 2023
1 parent b891584 commit d7dde08
Show file tree
Hide file tree
Showing 26 changed files with 571 additions and 4 deletions.
3 changes: 2 additions & 1 deletion docs/resources/equinix_fabric_connection.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,10 @@ Read-Only:
<a id="nestedatt--a_side--access_point--port--redundancy"></a>
### Nested Schema for `a_side.access_point.port.redundancy`

Read-Only:
Optional:

- `priority` (String)
- `group` (String)



Expand Down
1 change: 1 addition & 0 deletions equinix/fabric_connection_schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,7 @@ func createRedundancySch() map[string]*schema.Schema {
"group": {
Type: schema.TypeString,
Computed: true,
Optional: true,
Description: "Redundancy group identifier",
},
"priority": {
Expand Down
6 changes: 4 additions & 2 deletions equinix/fabric_mapping_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,11 @@ func redundancyToFabric(schemaRedundancy []interface{}) v4.ConnectionRedundancy
red := v4.ConnectionRedundancy{}
for _, r := range schemaRedundancy {
redundancyMap := r.(map[string]interface{})
priorityCont := v4.ConnectionPriority(redundancyMap["priority"].(string))
connectionPriority := v4.ConnectionPriority(redundancyMap["priority"].(string))
redundancyGroup := redundancyMap["group"].(string)
red = v4.ConnectionRedundancy{
Priority: &priorityCont,
Priority: &connectionPriority,
Group: redundancyGroup,
}
}
return red
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# ECX Fabric Layer2 Single Connection from fabric cloud router to Azure

This example shows how create single connection from Fabric Cloud Router to Azure, 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
`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` - Azure authorization key, service key generated from Azure Portal
`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

## Azure login

Log in to Azure 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 cloudRouter2azure/single-connection`
- 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 fcr2azure connection resource |
| READ | `terraform show` | Reads/Shows the current state of the fcr2azure connection resource |
| UPDATE | `terraform apply -refresh` | Updates the fcr2azure with values provided in the terraform.tfvars file |
| DELETE | `terraform destroy –auto-approve` | Deletes the created fcr2azure connection resource |
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" "azure"{
filter{
property = "/name"
operator = "="
values = [var.fabric_sp_name]
}
}

resource "equinix_fabric_connection" "fcr2azure"{
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
peering_type = var.peering_type
profile {
type = var.zside_ap_profile_type
uuid = var.zside_ap_profile_uuid
}
location {
metro_code = var.zside_location
}
}
}
}

output "connection_result" {
value = equinix_fabric_connection.fcr2azure.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_Id"
equinix_client_secret = "Equinix_Client_Secret"
connection_name = "fcr_2_azure"
connection_type = "IP_VC"
notifications_type = "ALL"
notifications_emails = ["[email protected]"]
bandwidth = 50
redundancy = "PRIMARY"
redundancy_group_uuid = "" #OPTIONAL
purchase_order_number = "1-323292"
peering_type = "PRIVATE"
aside_ap_type = "CLOUD_ROUTER"
fcr_uuid = "Cloud Router UUID"
zside_ap_type = "SP"
zside_ap_authentication_key = "Azure Service Key"
zside_ap_profile_type = "L2_PROFILE"
zside_ap_profile_uuid = ""
zside_location = "SV"
fabric_sp_name = "Azure Express Route"
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
variable "equinix_client_id" {}
variable "equinix_client_secret" {}
variable "connection_name" {}
variable "connection_type" {}
variable "notifications_type" {}
variable "notifications_emails" {}
variable "bandwidth" {}
variable "redundancy" {}
variable "redundancy_group_uuid" {}
variable "purchase_order_number" {}
variable "peering_type" {}
variable "aside_ap_type" {}
variable "fcr_uuid" {}
variable "zside_ap_type" {}
variable "zside_ap_authentication_key" {}
variable "zside_ap_profile_type" {}
variable "zside_ap_profile_uuid" {}
variable "zside_location" {}
variable "fabric_sp_name" {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# ECX Fabric Layer2 Two Redundant Connections from fabric cloud router to Azure

This example shows how create two redundant connections from Fabric Cloud Router to Azure, 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

`pri_connection_name` - the name of the primary connection
`sec_connection_name` - the name of the secondary connection
`connection_type` - connection type, please refer schema
`notifications_type` - notification type
`notifications_emails` - List of emails
`bandwidth` - bandwidth in MBs
`aside_ap_type` - Fabric Cloud Router type
`peering_type` - Peering type for the ECX Fabric Cloud Router on the a-side; typically PRIVATE
**Note: You can use one Cloud Router for both connections if you would like**
`cloud_router_primary_uuid` - UUID of ECX Fabric Cloud Router on a-side
`cloud_router_secondary_uuid` - UUID of ECX Fabric Cloud Router on a-side for secondary connection
`zside_ap_type` - Z side access point type
`zside_ap_authentication_key` - Azure authorization key, service key generated from Azure Portal
`zside_ap_profile_type` - Service profile type
`zside_ap_profile_uuid` - Service profile UUID
`zside_location` - Seller location
`fabric_sp_name` - Service profile name, fetched based on Service Profile get call using Service Profile search schema

## Azure login

Log in to Azure 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 cloudRouter2azure/two-connections`
- 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 fcr2azure redundant connection resources |
| READ | `terraform show` | Reads/Shows the current state of the fcr2azure connection resources |
| UPDATE | `terraform apply -refresh` | Updates the fcr2azure with values provided in the terraform.tfvars file |
| DELETE | `terraform destroy –auto-approve` | Deletes the created fcr2azure connection resources |
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
provider "equinix" {
client_id = var.equinix_client_id
client_secret = var.equinix_client_secret
}

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

resource "equinix_fabric_connection" "fcr2azure"{
name = var.pri_connection_name
type = var.connection_type

notifications {
type = var.notifications_type
emails = var.notifications_emails
}

bandwidth = var.bandwidth
redundancy {
priority = "PRIMARY"
}
order {
purchase_order_number = var.pri_purchase_order_number
}
a_side {
access_point {
type = var.aside_ap_type
router {
uuid = var.cloud_router_primary_uuid
}
}
}

z_side {
access_point {
type = var.zside_ap_type
authentication_key = var.zside_ap_authentication_key
profile {
type = var.zside_ap_profile_type
uuid = var.zside_ap_profile_uuid
}
location {
metro_code = var.zside_location
}
peering_type = var.peering_type
}
}
}

resource "equinix_fabric_connection" "fcr2azure2"{
name = var.sec_connection_name

type = var.connection_type

notifications {
type = var.notifications_type
emails = var.notifications_emails
}

bandwidth = var.bandwidth
/*`redundancy` - Cloud router redundancy **Note: in order to use resource dependency with redundancy because
it is a set type with max items of 1; put it into the one() terraform function before attempting to address
its children.
I.e. one(equinix_fabric_connection.connection_name.redundancy).group**
*/
redundancy {
priority = "SECONDARY"
group = one(equinix_fabric_connection.fcr2azure.redundancy).group
}
order {
purchase_order_number = var.sec_purchase_order_number
}
a_side {
access_point {
type = var.aside_ap_type
router {
uuid = var.cloud_router_secondary_uuid
}
}
}

z_side {
access_point {
type = var.zside_ap_type
authentication_key = var.zside_ap_authentication_key
profile {
type = var.zside_ap_profile_type
uuid = var.zside_ap_profile_uuid
}
location {
metro_code = var.zside_location
}
peering_type = var.peering_type
}
}
}

output "primary_connection_result" {
value = equinix_fabric_connection.fcr2azure.id
}

output "secondary_connection_result" {
value = equinix_fabric_connection.fcr2azure2.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,20 @@
equinix_client_id = "Equinix_Client_Id"
equinix_client_secret = "Equinix_Client_Secret"
pri_connection_name = "fcr_2_azure_pri"
sec_connection_name = "fcr_2_azure_sec"
connection_type = "IP_VC"
notifications_type = "ALL"
notifications_emails = ["[email protected]"]
bandwidth = 50
pri_purchase_order_number = "1-323202"
sec_purchase_order_number = "1-323292"
peering_type="PRIVATE"
aside_ap_type = "CLOUD_ROUTER"
cloud_router_primary_uuid = "19514e72-f1c0-497c-a550-664aa75cb28c"
cloud_router_secondary_uuid = "56cfbf37-2ffd-4dac-b797-782bb5f459fc"
zside_ap_type = "SP"
zside_ap_authentication_key = "Azure Service Key"
zside_ap_profile_type = "L2_PROFILE"
zside_ap_profile_uuid = "bfb74121-7e2c-4f74-99b3-69cdafb03b41"
zside_location = "SV"
fabric_sp_name = "Azure ExpressRoute"
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
variable "equinix_client_id" {}
variable "equinix_client_secret" {}
variable "pri_connection_name" {}
variable "sec_connection_name" {}
variable "connection_type" {}
variable "notifications_type" {}
variable "notifications_emails" {}
variable "bandwidth" {}
variable "pri_purchase_order_number" {}
variable "sec_purchase_order_number" {}
variable "peering_type" {}
variable "aside_ap_type" {}
variable "cloud_router_primary_uuid" {}
variable "cloud_router_secondary_uuid" {}
variable "zside_ap_type" {}
variable "zside_ap_authentication_key" {}
variable "zside_ap_profile_type" {}
variable "zside_ap_profile_uuid" {}
variable "zside_location" {}
variable "fabric_sp_name" {}
Loading

0 comments on commit d7dde08

Please sign in to comment.