-
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.
CXF 97984: Add Example in Modules and Sanity case for VD to AWS (#121)
* CXF-97984: Add example - VD to AWS * CXF-97984: Add sanity tests and tests in GHA * CXF-97984: Cleanup extra code * CXF-97984: Fix formatting * CXF-97984: Fix formatting * CXF-97984: Fix formatting * CXF-97984: Fix formatting * CXF-97984: Fix formatting * CXF-97984: main.tf consistent formatting * CXF-97984: Address PR comments * CXF-97984: Prod sanity suite changes * CXF-97984: Address PR comments * CXF-97984: Add lines * CXF-97984: Fix typo * CXF-97984: Fix typo
- Loading branch information
Showing
14 changed files
with
536 additions
and
2 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
provider "equinix" { | ||
client_id = var.equinix_client_id | ||
client_secret = var.equinix_client_secret | ||
} | ||
|
||
provider "aws" { | ||
access_key = var.additional_info[0]["value"] | ||
secret_key = var.additional_info[1]["value"] | ||
region = var.zside_seller_region | ||
} | ||
|
||
## Creates NE ACL template and assigns it to the network device | ||
resource "equinix_network_acl_template" "wan-acl-template" { | ||
name = var.template_name | ||
description = var.template_description | ||
inbound_rule { | ||
subnet = var.template_subnet | ||
protocol = var.template_protocol | ||
src_port = var.template_src_port | ||
dst_port = var.template_dst_port | ||
} | ||
} | ||
|
||
resource "equinix_network_device" "C8KV-SV" { | ||
name = var.ne_name | ||
metro_code = var.ne_metro_code | ||
type_code = var.ne_type_code | ||
self_managed = true | ||
byol = true | ||
package_code = var.ne_package_code | ||
notifications = var.ne_notifications | ||
hostname = var.ne_hostname | ||
account_number = var.ne_account_number | ||
version = var.ne_version | ||
core_count = var.ne_core_count | ||
term_length = var.ne_term_length | ||
|
||
ssh_key { | ||
username = var.ne_ssh_key_username | ||
key_name = var.ne_ssh_key_name | ||
} | ||
acl_template_id = equinix_network_acl_template.wan-acl-template.id | ||
} | ||
|
||
#Connection | ||
module "virtual_device_2_aws_connection" { | ||
source = "../../modules/virtual-device-connection" | ||
|
||
connection_name = var.connection_name | ||
connection_type = var.connection_type | ||
notifications_type = var.notifications_type | ||
notifications_emails = var.notifications_emails | ||
additional_info = var.additional_info | ||
bandwidth = var.bandwidth | ||
purchase_order_number = var.purchase_order_number | ||
|
||
# A-side | ||
aside_vd_type = var.aside_vd_type | ||
aside_vd_uuid = equinix_network_device.C8KV-SV.id | ||
|
||
#Zside | ||
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 "aws_dx_connection" "aws_connection" { | ||
depends_on = [ | ||
module.virtual_device_2_aws_connection | ||
] | ||
name = var.connection_name | ||
} | ||
|
||
resource "aws_dx_gateway" "aws_gateway" { | ||
depends_on = [ | ||
module.virtual_device_2_aws_connection | ||
] | ||
name = var.aws_gateway_name | ||
amazon_side_asn = var.aws_gateway_asn | ||
} | ||
|
||
resource "aws_dx_private_virtual_interface" "aws_virtual_interface" { | ||
depends_on = [ | ||
module.virtual_device_2_aws_connection, | ||
aws_dx_gateway.aws_gateway | ||
] | ||
connection_id = data.aws_dx_connection.aws_connection.id | ||
name = var.aws_vif_name | ||
vlan = data.aws_dx_connection.aws_connection.vlan_id | ||
address_family = var.aws_vif_address_family | ||
bgp_asn = var.aws_vif_bgp_asn | ||
amazon_address = var.aws_vif_amazon_address | ||
customer_address = var.aws_vif_customer_address | ||
bgp_auth_key = var.aws_vif_bgp_auth_key | ||
dx_gateway_id = aws_dx_gateway.aws_gateway.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
output "virtual_device_id" { | ||
value = equinix_network_device.C8KV-SV.id | ||
} | ||
output "aws_connection_id" { | ||
value = module.virtual_device_2_aws_connection.primary_connection_id | ||
} |
67 changes: 67 additions & 0 deletions
67
examples/virtual-device-2-aws-connection/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,67 @@ | ||
equinix_client_id = "MyEquinixClientId" | ||
equinix_client_secret = "MyEquinixSecret" | ||
|
||
#NE Acl Template | ||
template_name = "test-wan-acl-template" | ||
template_description = "WAN ACL template" | ||
template_subnet = "172.16.25.0/24" | ||
template_protocol = "TCP" | ||
template_src_port = "any" | ||
template_dst_port = "22" | ||
|
||
#Network Edge | ||
ne_name = "Terra_Test_router" | ||
ne_metro_code = "SV" | ||
ne_type_code = "C8000V" | ||
ne_package_code = "network-essentials" | ||
ne_notifications = ["[email protected]"] | ||
ne_hostname = "C8KV" | ||
ne_account_number = "182390403" | ||
ne_version = "17.11.01a" | ||
ne_core_count = 2 | ||
ne_term_length = 1 | ||
|
||
ne_ssh_key_username = "<SSH_Key_Username>" | ||
ne_ssh_key_name = "<SSH_Key_Name" | ||
|
||
#VD_2_AWS_Connection | ||
aside_vd_type = "EDGE" | ||
aside_vd_uuid = "<Virtual Device UUID>" | ||
zside_ap_type = "SP" | ||
zside_ap_profile_type = "L2_PROFILE" | ||
zside_location = "SV" | ||
zside_sp_name = "AWS" | ||
zside_peering_type = "PRIVATE" | ||
|
||
notifications_type = "ALL" | ||
notifications_emails = ["[email protected]","[email protected]"] | ||
purchase_order_number = "1-323292" | ||
connection_name = "VD_2_AWS" | ||
connection_type = "EVPL_VC" | ||
bandwidth = 50 | ||
zside_ap_type = "SP" | ||
zside_ap_authentication_key = "<AWS Account Id>" | ||
zside_ap_profile_type = "L2_PROFILE" | ||
zside_location = "SV" | ||
zside_seller_region = "us-west-1" | ||
zside_fabric_sp_name = "AWS Direct Connect" | ||
additional_info = [ | ||
{ | ||
key = "accessKey" | ||
value = "<aws_access_key>" | ||
}, | ||
{ | ||
key = "secretKey" | ||
value = "<aws_secret_key>" | ||
} | ||
] | ||
|
||
#AWS Provider | ||
aws_gateway_name = "aws_gateway" | ||
aws_gateway_asn = 64518 | ||
aws_vif_name = "port2aws" | ||
aws_vif_address_family = "ipv4" | ||
aws_vif_bgp_asn = 64999 | ||
aws_vif_amazon_address = "169.254.0.1/30" | ||
aws_vif_customer_address = "169.254.0.2/30" | ||
aws_vif_bgp_auth_key = "secret" |
Oops, something went wrong.