-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CXF-99867: Integrate Alibaba Terraform Provider with Fabric Connection Examples #155
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
3793d99
CXF-99867: Port to Alibaba Example
d-bhola 1c98dc7
CXF-99867: Fix special characters error and minor improvements
d-bhola d1e7467
CXF-99867: Fix typo
d-bhola e2c6a1a
CXF-99867: Address PR comments
d-bhola d34ba3f
CXF-99867: Update README.md
d-bhola d3c31aa
CXF-99867: Update step 2 in README.md
d-bhola 0b7c221
CXF-99867: Address PR comments
d-bhola ed444b4
CXF-99867: Address PR comments
d-bhola d31fcbc
CXF-99867: Address PR comments
d-bhola ec5ce64
CXF-99867: Add bullets to the deletion step
d-bhola File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
52 changes: 52 additions & 0 deletions
52
examples/port-2-alibaba-connection-with-alicloud-terraform-integration/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# Fabric Port to Fabric Alibaba Profile Connection | ||
|
||
This example shows how to leverage the [Fabric Port Connection Module](https://registry.terraform.io/modules/equinix/fabric/equinix/latest/submodules/port-connection) | ||
to create a Fabric Connection from a Fabric Port to Fabric Alibaba Service Profile. | ||
|
||
It leverages the Equinix Terraform Provider, the Alibaba Terraform Provider, and the Fabric Port Connection | ||
Module to setup the connection based on the parameters you have provided to this example; or based on the pattern | ||
you see used in this example it will allow you to create a more specific use case for your own needs. | ||
|
||
See example usage below for details on how to use this example. | ||
### Step by Step Instructions for Fabric Port to Fabric Alibaba Profile Connection | ||
|
||
#### 1. Create Connection from Equinix Terraform Provider | ||
|
||
**Note:** The `connection_name` must follow either one of these patterns: | ||
|
||
* A unique `connection_name` with atmost 24 characters | ||
`connection_name = var.connection_name` | ||
* A `connection_name` with atmost 12 characters combined with a random string of 12 characters: | ||
`connection_name = "${var.connection_name}${random_string.random.result}"` | ||
Use the `random_string` resource to perform this operation: | ||
```hcl | ||
resource "random_string" "random" { | ||
length = 12 | ||
special = false | ||
} | ||
``` | ||
* A unique `connection_name` is generated by appending a 12-character random string to the variable name given by the user | ||
* A Fabric Port to Alibaba Profile Connection is successfully created and displayed in the Fabric Portal | ||
* An Express Connect Physical Connection resource is created and becomes visible in the Alibaba Portal | ||
|
||
#### 2. Formulate main.tf and output.tf Files | ||
* When you run the initial `terraform apply`, the resources and data sources (from the example) are in comments | ||
* The comments can be removed after you accept the connection with the Alibaba portal | ||
|
||
#### 3. Accept the Connection Request | ||
* Manually accept the connection request in the Alibaba Portal for the created physical connection | ||
|
||
#### 4. Create the Virtual Border Router (VBR) Resource | ||
* Remove the commented code to create the VBR resource | ||
* Run `terraform init` to initialize and `terraform apply` to deploy the configuration | ||
* The VBR resource is created successfully and linked to the physical connection | ||
|
||
#### 5. Delete Resources | ||
* Run `terraform destroy` to delete the Alibaba VBR | ||
* Directly deleting the Equinix Fabric connection, will result in the following error: `ERR-UAA-003-00: Deletion for a provisioned connection needs to be initiated from Alibaba Portal` | ||
* Go to the Alibaba Portal to manually **terminate** and then **delete** the physical connection | ||
* This action will automatically delete the connection on the Equinix side, updating its status to Deprovisioned on both Equinix and Provider side | ||
|
||
<!-- BEGIN_TF_DOCS --> | ||
|
||
<!-- END_TF_DOCS --> |
60 changes: 60 additions & 0 deletions
60
examples/port-2-alibaba-connection-with-alicloud-terraform-integration/main.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
provider "equinix" { | ||
client_id = var.equinix_client_id | ||
client_secret = var.equinix_client_secret | ||
} | ||
|
||
module "create_port_2_alibaba_connection" { | ||
source = "../../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 | ||
project_id = var.project_id | ||
|
||
# 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 | ||
} | ||
|
||
# provider "alicloud" { | ||
# access_key = var.access_key | ||
# secret_key = var.secret_key | ||
# region = var.region | ||
# } | ||
# | ||
# data "alicloud_express_connect_physical_connections" "nameRegex" { | ||
# name_regex = "^${module.create_port_2_alibaba_connection.primary_connection.name}" | ||
# } | ||
# | ||
# resource "alicloud_express_connect_virtual_border_router" "vbr" { | ||
# local_gateway_ip = var.local_gateway_ip | ||
# peer_gateway_ip = var.peer_gateway_ip | ||
# peering_subnet_mask = var.peering_subnet_mask | ||
# physical_connection_id = data.alicloud_express_connect_physical_connections.nameRegex.connections[0].id | ||
# virtual_border_router_name = var.virtual_border_router_name | ||
# vlan_id = one(one(one(module.create_port_2_alibaba_connection.primary_connection.z_side).access_point).link_protocol).vlan_tag | ||
# min_rx_interval = var.min_rx_interval | ||
# min_tx_interval = var.min_tx_interval | ||
# detect_multiplier = var.detect_multiplier | ||
# } | ||
# | ||
# resource "null_resource" "destroy_warning" { | ||
# triggers = { | ||
# warning = "WARNING: Destroy process is not complete yet. You need to delete the resource from Alibaba Portal!" | ||
# } | ||
# } | ||
# | ||
# data "alicloud_express_connect_virtual_border_routers" "nameRegexVbr" { | ||
# name_regex = "^${alicloud_express_connect_virtual_border_router.vbr.virtual_border_router_name}" | ||
# } |
21 changes: 21 additions & 0 deletions
21
examples/port-2-alibaba-connection-with-alicloud-terraform-integration/outputs.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
output "alibaba_connection" { | ||
value = module.create_port_2_alibaba_connection.primary_connection | ||
sensitive = true | ||
} | ||
|
||
output "alibaba_connection_id" { | ||
value = module.create_port_2_alibaba_connection.primary_connection_id | ||
} | ||
|
||
# output "alicloud_express_connect_virtual_border_router" { | ||
# value = alicloud_express_connect_virtual_border_router.vbr | ||
# sensitive = true | ||
# } | ||
# | ||
# output "alicloud_express_connect_virtual_border_router_id" { | ||
# value = alicloud_express_connect_virtual_border_router.vbr.id | ||
# } | ||
# | ||
# output "express_connect_virtual_border_router_id" { | ||
# value = data.alicloud_express_connect_virtual_border_routers.nameRegexVbr.routers.0.id | ||
# } |
33 changes: 33 additions & 0 deletions
33
...es/port-2-alibaba-connection-with-alicloud-terraform-integration/terraform.tfvars.example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
equinix_client_id = "MyEquinixClientId" | ||
equinix_client_secret = "MyEquinixSecret" | ||
|
||
connection_name = "Port_2_alibaba" | ||
connection_type = "EVPL_VC" | ||
notifications_type = "ALL" | ||
notifications_emails = ["[email protected]"] | ||
bandwidth = 50 | ||
purchase_order_number = "1-323292" | ||
aside_port_name = "sit-tb1-dc-e5.tlab,10GSMF,A,001,201257, 21951980" | ||
aside_vlan_tag = 2019 | ||
zside_ap_type = "SP" | ||
zside_ap_authentication_key = "<Alibaba Auth Key>" | ||
zside_ap_profile_type = "L2_PROFILE" | ||
zside_location = "SY" | ||
zside_sp_name = "Alibaba Cloud Express Connect" | ||
zside_seller_region = "ap-southeast-2" | ||
zside_ap_profile_type = "L2_PROFILE" | ||
zside_ap_type = "SP" | ||
zside_location = "SV" | ||
zside_seller_region = "us-west-1" | ||
zside_sp_name = "Alibaba Cloud Express Connect" | ||
region = "us-west-1" | ||
local_gateway_ip = "10.0.0.1" | ||
peer_gateway_ip = "10.0.0.2" | ||
peering_subnet_mask = "255.255.255.252" | ||
virtual_border_router_name = "Port_2_Alibaba_VBR" | ||
min_rx_interval = 1000 | ||
min_tx_interval = 1000 | ||
detect_multiplier = 10 | ||
access_key = "<Alibaba_Cloud_Access_Key>" | ||
secret_key = "<Alibaba_Cloud_Secret_Key>" | ||
project_id = "<Fabric_Project_ID>" |
133 changes: 133 additions & 0 deletions
133
examples/port-2-alibaba-connection-with-alicloud-terraform-integration/variables.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
variable "equinix_client_id" { | ||
description = "Equinix client ID (consumer key), obtained after registering app in the developer platform" | ||
type = string | ||
sensitive = true | ||
} | ||
variable "equinix_client_secret" { | ||
description = "Equinix client secret ID (consumer secret), obtained after registering app in the developer platform" | ||
type = string | ||
sensitive = true | ||
} | ||
variable "connection_name" { | ||
description = "Connection name. An alpha-numeric 24 characters string which can include only hyphens and underscores" | ||
type = string | ||
} | ||
variable "project_id" { | ||
description = "Subscriber-assigned project ID" | ||
type = string | ||
default = "" | ||
} | ||
variable "connection_type" { | ||
description = "Defines the connection type like VG_VC, EVPL_VC, EPL_VC, EC_VC, IP_VC, ACCESS_EPL_VC" | ||
type = string | ||
} | ||
variable "notifications_type" { | ||
description = "Notification Type - ALL is the only type currently supported" | ||
type = string | ||
default = "ALL" | ||
} | ||
variable "notifications_emails" { | ||
description = "Array of contact emails" | ||
type = list(string) | ||
} | ||
variable "bandwidth" { | ||
description = "Connection bandwidth in Mbps" | ||
type = number | ||
} | ||
variable "purchase_order_number" { | ||
description = "Purchase order number" | ||
type = string | ||
default = "" | ||
} | ||
variable "aside_port_name" { | ||
description = "Equinix A-Side Port Name" | ||
type = string | ||
} | ||
variable "aside_vlan_tag" { | ||
description = "Vlan Tag information, outer vlanSTag for QINQ connections" | ||
type = string | ||
} | ||
variable "aside_vlan_inner_tag" { | ||
description = "Vlan Inner Tag information, inner vlanCTag for QINQ connections" | ||
type = string | ||
default = "" | ||
} | ||
variable "zside_ap_type" { | ||
description = "Access point type - COLO, VD, VG, SP, IGW, SUBNET, GW" | ||
type = string | ||
} | ||
variable "zside_ap_authentication_key" { | ||
description = "Authentication key for provider based connections" | ||
type = string | ||
sensitive = true | ||
} | ||
variable "zside_ap_profile_type" { | ||
description = "Service profile type - L2_PROFILE, L3_PROFILE, ECIA_PROFILE, ECMC_PROFILE" | ||
type = string | ||
} | ||
variable "zside_location" { | ||
description = "Access point metro code" | ||
type = string | ||
} | ||
variable "zside_sp_name" { | ||
description = "Equinix Service Profile Name" | ||
type = string | ||
} | ||
variable "zside_seller_region" { | ||
description = "Access point seller region" | ||
type = string | ||
} | ||
variable "region" { | ||
description = "Region" | ||
type = string | ||
} | ||
variable "access_point_id" { | ||
description = "Access Point ID" | ||
type = string | ||
default = "" | ||
} | ||
variable "local_gateway_ip" { | ||
thogarty marked this conversation as resolved.
Show resolved
Hide resolved
|
||
description = "Local Gateway IP" | ||
type = string | ||
default = "" | ||
} | ||
variable "peer_gateway_ip" { | ||
description = "Peer Gateway IP" | ||
type = string | ||
default = "" | ||
} | ||
variable "peering_subnet_mask" { | ||
description = "Peering Subnet Mask" | ||
type = string | ||
default = "" | ||
} | ||
variable "min_rx_interval" { | ||
description = "Minimum RX Interval" | ||
type = string | ||
default = "" | ||
} | ||
variable "min_tx_interval" { | ||
description = "Minimum TX Interval" | ||
type = string | ||
default = "" | ||
} | ||
variable "detect_multiplier" { | ||
description = "Detect Multiplier" | ||
type = string | ||
default = "" | ||
} | ||
variable "virtual_border_router_name" { | ||
description = "Virtual Border Router Name" | ||
type = string | ||
default = "" | ||
} | ||
variable "access_key" { | ||
description = "Access Key" | ||
type = string | ||
sensitive = true | ||
} | ||
variable "secret_key" { | ||
description = "Secret Key" | ||
type = string | ||
sensitive = true | ||
} |
9 changes: 9 additions & 0 deletions
9
examples/port-2-alibaba-connection-with-alicloud-terraform-integration/versions.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
terraform { | ||
required_version = ">= 1.5.4" | ||
required_providers { | ||
equinix = { | ||
source = "equinix/equinix" | ||
version = ">= 2.9.0" | ||
} | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can I leave this Note here or remove this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is fine. You're bringing attention to something I didn't think had any issues.