-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
142 additions
and
167 deletions.
There are no files selected for viewing
61 changes: 61 additions & 0 deletions
61
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,61 @@ | ||
# 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 | ||
Use the following resources and data sources from the example (place them as comments initially): | ||
|
||
* `provider "alicloud"` | ||
* `data "alicloud_express_connect_physical_connections" {}` | ||
* `resource "alicloud_express_connect_virtual_border_router" {}` | ||
* `resource "null_resource" {}` | ||
* `output alicloud_express_connect_virtual_border_router {}` | ||
* `output alicloud_express_connect_virtual_border_router_id {}` | ||
|
||
#### 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 | ||
* The VBR resource is created successfully and linked to the physical connection. | ||
|
||
#### 5. [Cleanup] Delete Resources | ||
1. Run `terraform destroy` to delete the Alibaba Virtual Border Router (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.` | ||
|
||
|
||
2. 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 | ||
} | ||
|
||
# provider "alicloud" { | ||
# access_key = var.access_key | ||
# secret_key = var.secret_key | ||
# region = var.region | ||
# } | ||
|
||
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 | ||
} | ||
# | ||
# 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 | ||
# } |
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
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
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.