diff --git a/examples/cloud-router-2-aws-connection/main.tf b/examples/cloud-router-2-aws-connection/main.tf index 52b3c804..88640b90 100644 --- a/examples/cloud-router-2-aws-connection/main.tf +++ b/examples/cloud-router-2-aws-connection/main.tf @@ -2,7 +2,11 @@ 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 +} module "cloud_router_aws_connection" { source = "../../modules/cloud-router-connection" @@ -26,3 +30,42 @@ module "cloud_router_aws_connection" { zside_seller_region = var.zside_seller_region zside_fabric_sp_name = var.zside_fabric_sp_name } + +data "aws_dx_connection" "connection_id" { + depends_on = [ + module.cloud_router_aws_connection + ] + name = var.connection_name +} + +resource "aws_vpc" "example" { + depends_on = [ + module.cloud_router_aws_connection + ] + cidr_block = var.aws_vpc_cidr_block +} + +resource "aws_vpn_gateway" "example" { + depends_on = [ + module.cloud_router_aws_connection + ] + vpc_id = aws_vpc.example.id +} + +resource "aws_dx_private_virtual_interface" "example" { + depends_on = [ + module.cloud_router_aws_connection, + aws_vpn_gateway.example, + aws_vpc.example + ] + connection_id = data.aws_dx_connection.connection_id.id + name = var.aws_vif_name + vlan = var.aws_vif_vlan + 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 + vpn_gateway_id = aws_vpn_gateway.example.id +} + diff --git a/examples/cloud-router-2-aws-connection/outputs.tf b/examples/cloud-router-2-aws-connection/outputs.tf index ec5d88bd..3fbdad0c 100644 --- a/examples/cloud-router-2-aws-connection/outputs.tf +++ b/examples/cloud-router-2-aws-connection/outputs.tf @@ -1,3 +1,13 @@ output "module_output" { value = module.cloud_router_aws_connection.primary_connection_id } +output "aws_vpc_id" { + value = aws_vpc.example.id +} +output "aws_vpn_gateway_id" { + value = aws_vpn_gateway.example.id +} +output "aws_interface_id" { + value = aws_dx_private_virtual_interface.example.id +} + diff --git a/examples/cloud-router-2-aws-connection/terraform.tfvars.example b/examples/cloud-router-2-aws-connection/terraform.tfvars.example index e17c8515..ca8b1cc2 100644 --- a/examples/cloud-router-2-aws-connection/terraform.tfvars.example +++ b/examples/cloud-router-2-aws-connection/terraform.tfvars.example @@ -19,3 +19,12 @@ additional_info = [ { key = "accessKey", value = "" }, { key = "secretKey", value = "" } ] + +aws_vpc_cidr_block = "10.255.255.0/28" +aws_vif_name = "port2aws" +aws_vif_vlan = "320" +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" diff --git a/examples/cloud-router-2-aws-connection/variables.tf b/examples/cloud-router-2-aws-connection/variables.tf index f2f6073b..f1d990cf 100644 --- a/examples/cloud-router-2-aws-connection/variables.tf +++ b/examples/cloud-router-2-aws-connection/variables.tf @@ -71,9 +71,44 @@ variable "zside_seller_region" { type = string default = "" } - variable "additional_info" { description = "Additional parameters required for some service profiles. It should be a list of maps containing 'key' and 'value e.g. `[{ key='asn' value = '65000'}, { key='ip' value = '192.168.0.1'}]`" type = list(object({ key = string, value = string })) default = [] } +variable "aws_vpc_cidr_block" { + description = "The IPv4 CIDR block for the VPC" + type = string +} +variable "aws_vif_name" { + description = "The name for the virtual interface" + type = string +} +variable "aws_vif_vlan" { + description = " The VLAN ID" + type = string +} +variable "aws_vif_address_family" { + description = "The address family for the BGP peer. ipv4 or ipv6" + type = string +} +variable "aws_vif_bgp_asn" { + description = "The autonomous system (AS) number for Border Gateway Protocol (BGP) configuration" + type = number +} +variable "aws_vif_amazon_address" { + description = "The IPv4 CIDR address to use to send traffic to Amazon. Required for IPv4 BGP peers" + type = string + default = "" +} +variable "aws_vif_customer_address" { + description = "The IPv4 CIDR destination address to which Amazon should send traffic. Required for IPv4 BGP peers" + type = string + default = "" +} +variable "aws_vif_bgp_auth_key" { + description = "The authentication key for BGP configuration" + type = string + default = "" +} + diff --git a/examples/cloud-router-2-aws-connection/versions.tf b/examples/cloud-router-2-aws-connection/versions.tf index 8e226867..828b4ead 100644 --- a/examples/cloud-router-2-aws-connection/versions.tf +++ b/examples/cloud-router-2-aws-connection/versions.tf @@ -3,7 +3,11 @@ terraform { required_providers { equinix = { source = "equinix/equinix" - version = ">= 1.20.0" + version = ">= 1.25.1" + } + aws = { + source = "hashicorp/aws" + version = "~> 5.0" } } } diff --git a/examples/port-2-aws-connection/main.tf b/examples/port-2-aws-connection/main.tf index 4d0e73e1..4f726c92 100644 --- a/examples/port-2-aws-connection/main.tf +++ b/examples/port-2-aws-connection/main.tf @@ -2,8 +2,12 @@ provider "equinix" { client_id = var.equinix_client_id client_secret = var.equinix_client_secret } - -module "create_port_2_aws_connection" { +provider "aws" { + access_key = var.additional_info[0]["value"] + secret_key = var.additional_info[1]["value"] + region = var.zside_seller_region +} +module "port_2_aws_connection" { source = "../../modules/port-connection" connection_name = var.connection_name @@ -27,3 +31,41 @@ module "create_port_2_aws_connection" { zside_seller_region = var.zside_seller_region zside_sp_name = var.zside_sp_name } + +data "aws_dx_connection" "connection_id" { + depends_on = [ + module.port_2_aws_connection + ] + name = var.connection_name +} +resource "aws_vpc" "example" { + depends_on = [ + module.port_2_aws_connection + ] + cidr_block = var.aws_vpc_cidr_block +} + +resource "aws_vpn_gateway" "example" { + depends_on = [ + module.port_2_aws_connection + ] + vpc_id = aws_vpc.example.id +} + +resource "aws_dx_private_virtual_interface" "example" { + depends_on = [ + module.port_2_aws_connection, + aws_vpn_gateway.example, + aws_vpc.example + ] + + connection_id = data.aws_dx_connection.connection_id.id + name = var.aws_vif_name + vlan = var.aws_vif_vlan + 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 + vpn_gateway_id = aws_vpn_gateway.example.id +} diff --git a/examples/port-2-aws-connection/outputs.tf b/examples/port-2-aws-connection/outputs.tf index 648e19d7..94495b28 100644 --- a/examples/port-2-aws-connection/outputs.tf +++ b/examples/port-2-aws-connection/outputs.tf @@ -1,3 +1,12 @@ output "aws_connection_id" { - value = module.create_port_2_aws_connection.primary_connection_id + value = module.port_2_aws_connection.primary_connection_id +} +output "aws_vpc_id" { + value = aws_vpc.example.id +} +output "aws_vpn_gateway_id" { + value = aws_vpn_gateway.example.id +} +output "aws_interface_id" { + value = aws_dx_private_virtual_interface.example.id } diff --git a/examples/port-2-aws-connection/terraform.tfvars.example b/examples/port-2-aws-connection/terraform.tfvars.example index 3c70215a..6662bd47 100644 --- a/examples/port-2-aws-connection/terraform.tfvars.example +++ b/examples/port-2-aws-connection/terraform.tfvars.example @@ -20,3 +20,12 @@ additional_info = [ { key = "accessKey", value = "" }, { key = "secretKey", value = "" } ] + +aws_vpc_cidr_block = "10.255.255.0/28" +aws_vif_name = "port2aws" +aws_vif_vlan = "320" +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" \ No newline at end of file diff --git a/examples/port-2-aws-connection/variables.tf b/examples/port-2-aws-connection/variables.tf index d2d5fb6f..a1f58f76 100644 --- a/examples/port-2-aws-connection/variables.tf +++ b/examples/port-2-aws-connection/variables.tf @@ -6,7 +6,6 @@ variable "equinix_client_secret" { description = "Equinix client secret ID (consumer secret), obtained after registering app in the developer platform" type = string } - variable "connection_name" { description = "Connection name. An alpha-numeric 24 characters string which can include only hyphens and underscores" type = string @@ -33,7 +32,6 @@ variable "purchase_order_number" { type = string default = "" } - variable "aside_port_name" { description = "Equinix A-Side Port Name" type = string @@ -77,3 +75,39 @@ variable "additional_info" { type = list(object({ key = string, value = string })) default = [] } +variable "aws_vpc_cidr_block" { + description = "The IPv4 CIDR block for the VPC" + type = string +} +variable "aws_vif_name" { + description = "The name for the virtual interface" + type = string +} +variable "aws_vif_vlan" { + description = " The VLAN ID" + type = string +} +variable "aws_vif_address_family" { + description = "The address family for the BGP peer. ipv4 or ipv6" + type = string +} +variable "aws_vif_bgp_asn" { + description = "The autonomous system (AS) number for Border Gateway Protocol (BGP) configuration" + type = number +} +variable "aws_vif_amazon_address" { + description = "The IPv4 CIDR address to use to send traffic to Amazon. Required for IPv4 BGP peers" + type = string + default = "" +} +variable "aws_vif_customer_address" { + description = "The IPv4 CIDR destination address to which Amazon should send traffic. Required for IPv4 BGP peers" + type = string + default = "" +} +variable "aws_vif_bgp_auth_key" { + description = "The authentication key for BGP configuration" + type = string + default = "" +} + diff --git a/examples/port-2-aws-connection/versions.tf b/examples/port-2-aws-connection/versions.tf index 8e226867..828b4ead 100644 --- a/examples/port-2-aws-connection/versions.tf +++ b/examples/port-2-aws-connection/versions.tf @@ -3,7 +3,11 @@ terraform { required_providers { equinix = { source = "equinix/equinix" - version = ">= 1.20.0" + version = ">= 1.25.1" + } + aws = { + source = "hashicorp/aws" + version = "~> 5.0" } } } diff --git a/examples/service-token-metal-2-fabric-aws-connection/main.tf b/examples/service-token-metal-2-fabric-aws-connection/main.tf index c3bc3acb..6203bc36 100644 --- a/examples/service-token-metal-2-fabric-aws-connection/main.tf +++ b/examples/service-token-metal-2-fabric-aws-connection/main.tf @@ -1,7 +1,12 @@ provider "equinix" { client_id = var.equinix_client_id client_secret = var.equinix_client_secret - auth_token = var.metal_auth_token // added + auth_token = var.metal_auth_token +} +provider "aws" { + access_key = var.additional_info[0]["value"] + secret_key = var.additional_info[1]["value"] + region = var.zside_seller_region } resource "random_string" "random" { length = 3 @@ -68,3 +73,40 @@ module "metal-2-fabric-connection" { zside_seller_region = var.zside_seller_region zside_sp_name = var.zside_sp_name } +data "aws_dx_connection" "connection_id" { + depends_on = [ + module.metal-2-fabric-connection + ] + name = var.connection_name +} + +resource "aws_vpc" "example" { + depends_on = [ + module.metal-2-fabric-connection + ] + cidr_block = var.aws_vpc_cidr_block +} + +resource "aws_vpn_gateway" "example" { + depends_on = [ + module.metal-2-fabric-connection + ] + vpc_id = aws_vpc.example.id +} + +resource "aws_dx_private_virtual_interface" "example" { + depends_on = [ + module.metal-2-fabric-connection, + aws_vpn_gateway.example, + aws_vpc.example + ] + connection_id = data.aws_dx_connection.connection_id.id + name = var.aws_vif_name + vlan = var.aws_vif_vlan + 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 + vpn_gateway_id = aws_vpn_gateway.example.id +} diff --git a/examples/service-token-metal-2-fabric-aws-connection/outputs.tf b/examples/service-token-metal-2-fabric-aws-connection/outputs.tf index 14d08642..4dbe77ad 100644 --- a/examples/service-token-metal-2-fabric-aws-connection/outputs.tf +++ b/examples/service-token-metal-2-fabric-aws-connection/outputs.tf @@ -1,7 +1,15 @@ output "metal-connection" { value = equinix_metal_connection.metal-connection.id } - output "fabric-connection" { value = module.metal-2-fabric-connection.primary_connection_id } +output "aws_vpc_id" { + value = aws_vpc.example.id +} +output "aws_vpn_gateway_id" { + value = aws_vpn_gateway.example.id +} +output "aws_interface_id" { + value = aws_dx_private_virtual_interface.example.id +} diff --git a/examples/service-token-metal-2-fabric-aws-connection/terraform.tfvars.example b/examples/service-token-metal-2-fabric-aws-connection/terraform.tfvars.example index bcc0301b..c5d6ed0d 100644 --- a/examples/service-token-metal-2-fabric-aws-connection/terraform.tfvars.example +++ b/examples/service-token-metal-2-fabric-aws-connection/terraform.tfvars.example @@ -24,3 +24,12 @@ additional_info = [ { key = "accessKey", value = "" }, { key = "secretKey", value = "" } ] + +aws_vpc_cidr_block = "10.255.255.0/28" +aws_vif_name = "port2aws" +aws_vif_vlan = "320" +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" diff --git a/examples/service-token-metal-2-fabric-aws-connection/variables.tf b/examples/service-token-metal-2-fabric-aws-connection/variables.tf index 7413dd41..93a9ed0d 100644 --- a/examples/service-token-metal-2-fabric-aws-connection/variables.tf +++ b/examples/service-token-metal-2-fabric-aws-connection/variables.tf @@ -90,3 +90,38 @@ variable "additional_info" { type = list(object({ key = string, value = string })) default = [] } +variable "aws_vpc_cidr_block" { + description = "The IPv4 CIDR block for the VPC" + type = string +} +variable "aws_vif_name" { + description = "The name for the virtual interface" + type = string +} +variable "aws_vif_vlan" { + description = " The VLAN ID" + type = string +} +variable "aws_vif_address_family" { + description = "The address family for the BGP peer. ipv4 or ipv6" + type = string +} +variable "aws_vif_bgp_asn" { + description = "The autonomous system (AS) number for Border Gateway Protocol (BGP) configuration" + type = number +} +variable "aws_vif_amazon_address" { + description = "The IPv4 CIDR address to use to send traffic to Amazon. Required for IPv4 BGP peers" + type = string + default = "" +} +variable "aws_vif_customer_address" { + description = "The IPv4 CIDR destination address to which Amazon should send traffic. Required for IPv4 BGP peers" + type = string + default = "" +} +variable "aws_vif_bgp_auth_key" { + description = "The authentication key for BGP configuration" + type = string + default = "" +} diff --git a/examples/service-token-metal-2-fabric-aws-connection/versions.tf b/examples/service-token-metal-2-fabric-aws-connection/versions.tf index 81d18743..a01de9ac 100644 --- a/examples/service-token-metal-2-fabric-aws-connection/versions.tf +++ b/examples/service-token-metal-2-fabric-aws-connection/versions.tf @@ -3,7 +3,11 @@ terraform { required_providers { equinix = { source = "equinix/equinix" - version = ">= 1.20.0" + version = ">= 1.25.1" + } + aws = { + source = "hashicorp/aws" + version = "~> 5.0" } } }