Skip to content

Commit

Permalink
new example for metal service token a-side to IBM redundant connectio…
Browse files Browse the repository at this point in the history
…n end-to-end solution
  • Loading branch information
Oscar Cobles committed Jul 22, 2022
1 parent 5ac5d70 commit cc5c56c
Show file tree
Hide file tree
Showing 7 changed files with 217 additions and 1 deletion.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
## 0.2.0 (July 22, 2022)

ENHANCEMENTS:

- New example to establish an Equinix Fabric L2 Connection from Equinix Metal to IBM using an A-side Service Token
- Version of `equinix-fabric-connection` module was updated to v0.3.1
- Version of required equinix provider was updated to v1.7.0

BUG FIXES:

- typo `purchase_order` was `purcharse_order`

## 0.1.0 (April 29, 2022)

NOTES:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ See <https://registry.terraform.io/modules/equinix-labs/fabric-connection-ibm/eq
| [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) | module |
| [equinix_network_bgp.this](https://registry.terraform.io/providers/equinix/equinix/latest/docs/resources/equinix_network_bgp) | resource |
| [ibm_is_region.this](https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs/data-sources/is_region) | data source |
| [ibm_resource_group.this](https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs/data-sources/resource_group) | data source |
| [ibm_resource_group.this](https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs/resources/resource_group) | resource |
| [ibm_dl_gateways.this](https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs/data-sources/dl_gateways) | data source |
Expand All @@ -89,3 +88,4 @@ See <https://registry.terraform.io/modules/equinix-labs/fabric-connection-ibm/eq

- [Fabric Port connection](https://registry.terraform.io/modules/equinix-labs/fabric-connection-ibm/equinix/latest/examples/fabric-port-connection/)
- [Network Edge device connection](https://registry.terraform.io/modules/equinix-labs/fabric-connection-ibm/equinix/latest/examples/network-edge-device-connection/)
- [Service Token (a-side) Equinix Metal to IBM redundant connection End-to-End Solution](https://registry.terraform.io/modules/equinix-labs/fabric-connection-ibm/equinix/latest/examples/service-token-metal-to-ibm-connection/)
35 changes: 35 additions & 0 deletions examples/service-token-metal-to-ibm-connection/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Complete Equinix Metal connection (a-side) to IBM

~> Equinix Metal connection with automated `a_side` service token is not generally available and may not be enabled yet for your organization.

This example demonstrates usage of the Equinix Connection IBM module to establish an Equinix Fabric L2 Connection from Equinix Metal (a-side) to IBM Direct Link 2.0 using an [A-Side Token](https://docs.equinix.com/en-us/Content/Interconnection/Fabric/service%20tokens/Fabric-Service-Tokens.htm).It will:

- Use an existing Equinix Metal project.
- Create a new Equinix Metal VLAN in selected metro Silicon Valley (SV).
- Request an Equinix Metal shared connection in SV.
- Attach the Equinix Metal VLAN to the Virtual Circuit created for the Equinix Metal connection.
- Create an IBM VPC.
- Provision an Equinix Fabric l2 connection for IBM service profile with specified bandwidth and private peering.
- Approve IBM connection request.
- Create an IBM Direct Link virtual connection to the new IBM VPC.

## 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-ibm.git
cd terraform-equinix-fabric-connection-ibm/examples/service-token-metal-to-ibm-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-ibm/equinix/latest/examples/service-token-metal-to-ibm-connection?tab=inputs> for a description of all variables.

## Outputs

See <https://registry.terraform.io/modules/equinix-labs/fabric-connection-ibm/equinix/latest/examples/service-token-metal-to-ibm-connection?tab=outputs> for a description of all outputs.
73 changes: 73 additions & 0 deletions examples/service-token-metal-to-ibm-connection/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Configure the Equinix Provider
# Please refer to provider documentation for details on supported authentication methods and parameters.
# https://registry.terraform.io/providers/equinix/equinix/latest/docs
provider "equinix" {
client_id = var.equinix_provider_client_id
client_secret = var.equinix_provider_client_secret
}

# Configure the IBM Provider
# https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs#argument-reference
provider "ibm" {
ibmcloud_api_key = var.ibm_api_key // To create an API key, in the IBM Cloud console, go to Manage > Access (IAM) > API keys.
region = var.ibm_region // If unspecified, default region "us-south" (Dallas) will be used.
}

## Retrieve an existing equinix metal project
## If you prefer you can use resource equinix_metal_project instead to create a fresh project
data "equinix_metal_project" "this" {
project_id = var.metal_project_id
}

## Create an IBM VPC
## Comment out this block if ibm_create_dl_virtual_connection is false
## If you prefer you can use data ibm_is_vpc instead to use an existing VPC
resource "ibm_is_vpc" "this" {
name = format("vpc-metal-ibm-%s", lower(var.fabric_destination_metro_code))
}

locals {
connection_name = format("conn-metal-ibm-%s", lower(var.fabric_destination_metro_code))
}

# Create a new VLAN in Frankfurt
resource "equinix_metal_vlan" "this" {
description = format("VLAN in %s", var.fabric_destination_metro_code)
metro = var.fabric_destination_metro_code
project_id = data.equinix_metal_project.this.project_id
}

## Request a connection service token in Equinix Metal
resource "equinix_metal_connection" "this" {
name = local.connection_name
project_id = data.equinix_metal_project.this.project_id
metro = var.fabric_destination_metro_code
redundancy = "primary"
type = "shared"
service_token_type = "a_side"
description = format("connection to IBM in %s", var.fabric_destination_metro_code)
speed = format("%dMbps", var.fabric_speed)
vlans = [equinix_metal_vlan.this.vxlan]
}

## Configure the Equinix Fabric connection from Equinix Metal to AWS using the metal connection service token
module "equinix-fabric-connection-ibm-primary" {
source = "equinix-labs/fabric-connection-ibm/equinix"

fabric_notification_users = var.fabric_notification_users
fabric_connection_name = local.connection_name
fabric_destination_metro_code = var.fabric_destination_metro_code
fabric_speed = var.fabric_speed
fabric_service_token_id = equinix_metal_connection.this.service_tokens.0.id

ibm_account_id = var.ibm_account_id
ibm_api_key = var.ibm_api_key

ibm_create_dl_virtual_connection = true
ibm_vpc_id = ibm_is_vpc.this.id // required if ibm_create_dl_virtual_connection is true

## BGP Configuration
# ibm_direct_link_bgp_customer_peer_ip = "10.254.30.77/30" // If unspecified, it will be auto-generated
# ibm_direct_link_bgp_cloud_peer_ip = "10.254.30.78" // If unspecified, it will be auto-generated
# ibm_direct_link_bgp_customer_asn = 65000 // If unspecified, default value "65000" will be used
}
3 changes: 3 additions & 0 deletions examples/service-token-metal-to-ibm-connection/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
output "connection_primary_details" {
value = module.equinix-fabric-connection-ibm-primary
}
79 changes: 79 additions & 0 deletions examples/service-token-metal-to-ibm-connection/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
variable "equinix_provider_client_id" {
type = string
description = <<EOF
API Consumer Key available under 'My Apps' in developer portal. This argument can also be specified with the
EQUINIX_API_CLIENTID shell environment variable.
EOF
default = null
}

variable "equinix_provider_client_secret" {
type = string
description = <<EOF
API Consumer secret available under 'My Apps' in developer portal. This argument can also be specified with the
EQUINIX_API_CLIENTSECRET shell environment variable.
EOF
default = null
}

variable "ibm_api_key" {
type = string
description = <<EOF
The IBM Cloud platform API key. You must either add this variable or leave default "" and source it from the
IC_API_KEY (higher precedence) or IBMCLOUD_API_KEY environment variable.
NOTE: Even if you using other authentication method for the ibm terraform provider, the key (using the variable or
an environment variable) is required to approve the IBM Direct Link gateway connection using IBM cloud go SDK. To
create an API key, in the IBM Cloud console, go to Manage > Access (IAM) > API keys.
EOF
default = ""
}

variable "ibm_account_id" {
type = string
description = <<EOF
(Required) Your `IBM Cloud account ID`. Log in to the IBM Cloud console and select Manage > Account > Account
settings to locate your IBM account ID.
EOF
}

variable "ibm_vpc_name" {
type = string
description = "(Required) The name of an existing VPC."
}

variable "ibm_region" {
type = string
description = <<EOF
Destination Metro code where the connection will be created. One of: us-south, us-east, eu-gb, eu-de, jp-tok,
au-syd.
EOF
default = "us-south"
}

variable "metal_project_id" {
type = string
description = "(Required) ID of the project where the connection is scoped to, used to look up the project."
}

variable "fabric_notification_users" {
type = list(string)
description = "A list of email addresses used for sending connection update notifications."
default = ["example@equinix.com"]
}

variable "fabric_destination_metro_code" {
type = string
description = "Destination Metro code where the connection will be created."
default = "SV"
}

variable "fabric_speed" {
type = number
description = <<EOF
Speed/Bandwidth in Mbps to be allocated to the connection. If unspecified, it will be used the minimum
bandwidth available for the `Equinix Metal` service profile. Valid values are (50, 100, 200, 500, 1000, 2000, 5000,
10000).
EOF
default = 50
}
14 changes: 14 additions & 0 deletions examples/service-token-metal-to-ibm-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.7.0"
}
ibm = {
source = "IBM-Cloud/ibm"
version = ">= 1.12.0"
}
}
}

0 comments on commit cc5c56c

Please sign in to comment.