Skip to content
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

feat: Adding Oracle Terraform Provider to Fabric Examples #71

Merged
merged 18 commits into from
May 3, 2024
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
a8e026d
feat: Adding Oracle Terraform Provider to Fabric Examples
srushti-patl Apr 17, 2024
f01a9f7
nit: Adding extra indentation space
srushti-patl Apr 17, 2024
62162fd
misc:Updating GHA workflow for Oracle test
srushti-patl Apr 18, 2024
cb31aae
Merge branch 'main' into CXF-91727-Oracle-Provider-Integration
srushti-patl Apr 23, 2024
7800616
misc: Adding extra workflow for debugging purpose
srushti-patl Apr 23, 2024
c064eff
Merge remote-tracking branch 'origin/CXF-91727-Oracle-Provider-Integr…
srushti-patl Apr 23, 2024
b61024b
misc: Updating workflow with pull_request trigger
srushti-patl Apr 23, 2024
ad9e30f
misc: Updating workflow & Terratests for Port2Oracle connection
srushti-patl Apr 24, 2024
99ac10a
misc: Updating workflow for Port2Oracle connection
srushti-patl Apr 24, 2024
4da42d3
misc: Updating workflow for Port2Oracle connection
srushti-patl Apr 24, 2024
fe3d936
misc: Updating Port2Oracle connection workflow
srushti-patl Apr 24, 2024
eebff62
misc: Updating Port2Oracle connection workflow
srushti-patl Apr 24, 2024
ac8e3c9
misc: Updating oracle provider block by passing service key
srushti-patl Apr 25, 2024
a216fa5
Merge branch 'main' into CXF-91727-Oracle-Provider-Integration
srushti-patl Apr 26, 2024
a634772
fix: Updating oracle examples, metal terratests workflow and removing…
srushti-patl May 2, 2024
85f349c
Merge remote-tracking branch 'origin/CXF-91727-Oracle-Provider-Integr…
srushti-patl May 2, 2024
871f8cc
fix: removing port2oracle terratest from sanity test suite
srushti-patl May 2, 2024
838148a
fix:Updating equinix terraform provider to the latest version for or…
srushti-patl May 3, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/terratests-metal-nimf-suite.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@ jobs:
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage_metal-nimf_modules.txt
files: ./coverage_metal_nimf_modules.txt
8 changes: 7 additions & 1 deletion examples/cloud-router-2-azure-connection/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
output "module_output" {
output "azurerm_resource_group_id" {
value = azurerm_resource_group.fcr2azure.id
}
output "azurerm_express_route_circuit" {
value = azurerm_express_route_circuit.fcr2azure.id
}
output "azure_connection_id" {
value = module.cloud_router_azure_connection.primary_connection_id
}
10 changes: 8 additions & 2 deletions examples/cloud-router-2-azure-redundant-connection/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
output "module_output" {
output "azurerm_resource_group_id" {
value = azurerm_resource_group.fcr2azure.id
}
output "azurerm_express_route_circuit" {
value = azurerm_express_route_circuit.fcr2azure.id
}
output "azure_primary_connection_id" {
value = module.cloud_router_azure_redundant_connection.primary_connection_id
}
output "secondary_connection_result" {
output "azure_secondary_connection_id" {
value = var.secondary_connection_name != "" ? module.cloud_router_azure_redundant_connection.secondary_connection_id : null
}
45 changes: 41 additions & 4 deletions examples/cloud-router-2-oracle-connection/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,42 @@ provider "equinix" {
client_id = var.equinix_client_id
client_secret = var.equinix_client_secret
}
provider "oci" {
tenancy_ocid = var.oracle_tenancy_ocid
user_ocid = var.oracle_user_ocid
private_key = var.oracle_private_key
fingerprint = var.oracle_fingerprint
region = var.oracle_region
}

data "oci_core_fast_connect_provider_services" "fc_provider_services" {
compartment_id = var.oracle_compartment_id
}

locals {
fc_provider_services_id = element(
data.oci_core_fast_connect_provider_services.fc_provider_services.fast_connect_provider_services,
index(
data.oci_core_fast_connect_provider_services.fc_provider_services.fast_connect_provider_services.*.provider_name,
var.oracle_fastconnect_provider
)
).id
}

resource "oci_core_virtual_circuit" "test_virtual_circuit" {
display_name = var.oracle_vc_display_name
compartment_id = var.oracle_compartment_id
type = var.oracle_vc_type
bandwidth_shape_name = var.oracle_bandwidth
cross_connect_mappings {
customer_bgp_peering_ip = var.oracle_customer_bgp_peering_ip
oracle_bgp_peering_ip = var.oracle_bgp_peering_ip
}
customer_asn = var.oracle_customer_asn
region = var.oracle_region
provider_service_id = local.fc_provider_services_id
gateway_id = var.oracle_gateway_id
}

module "cloud_router_oracle_connection" {
source = "../../modules/cloud-router-connection"
Expand All @@ -10,19 +46,20 @@ module "cloud_router_oracle_connection" {
connection_type = var.connection_type
notifications_type = var.notifications_type
notifications_emails = var.notifications_emails
project_id = var.project_id
bandwidth = var.bandwidth
purchase_order_number = var.purchase_order_number

#Aside
#A-side
aside_ap_type = var.aside_ap_type
aside_fcr_uuid = var.aside_fcr_uuid

#Zside
#Z-side
zside_ap_type = var.zside_ap_type
zside_ap_authentication_key = var.zside_ap_authentication_key
zside_ap_authentication_key = oci_core_virtual_circuit.test_virtual_circuit.id
zside_ap_profile_type = var.zside_ap_profile_type
zside_location = var.zside_location
zside_peering_type = var.zside_peering_type
zside_seller_region = var.zside_seller_region
zside_seller_region = var.oracle_region
zside_fabric_sp_name = var.zside_fabric_sp_name
}
2 changes: 1 addition & 1 deletion examples/cloud-router-2-oracle-connection/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
output "module_output" {
output "oracle_connection_id" {
value = module.cloud_router_oracle_connection.primary_connection_id
}
17 changes: 15 additions & 2 deletions examples/cloud-router-2-oracle-connection/terraform.tfvars.example
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,22 @@ bandwidth = 1000
aside_ap_type = "CLOUD_ROUTER"
aside_fcr_uuid = "<Primary Fabric Cloud router UUID>"
zside_ap_type = "SP"
zside_ap_authentication_key = "<Oracle Authentication Key>"
zside_ap_profile_type = "L2_PROFILE"
zside_location = "SV"
zside_peering_type = "PRIVATE"
zside_seller_region = "us-ashburn-1"
zside_fabric_sp_name = "Oracle Cloud Infrastructure -OCI- FastConnect"

oracle_tenancy_ocid = "<Oracle Tenancy OCID>"
oracle_user_ocid = "<Oracle User OCID>"
oracle_private_key = "<Oracle Private Key>"
oracle_fingerprint = "<Oracle Fingerprint>"
oracle_region = "us-sanjose-1"
oracle_compartment_id = "<Oracle Compartment ID>",
oracle_fastconnect_provider = "Equinix"
oracle_vc_display_name = "FCR2Oracle"
oracle_vc_type = "PRIVATE"
oracle_bandwidth = "1 Gbps"
oracle_customer_bgp_peering_ip = "10.1.0.50/30"
oracle_bgp_peering_ip = "10.1.0.49/30"
oracle_customer_asn = "123456"
oracle_gateway_id = "<Oracle Gateway ID>"
75 changes: 65 additions & 10 deletions examples/cloud-router-2-oracle-connection/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ variable "notifications_emails" {
description = "Array of contact emails"
type = list(string)
}
variable "project_id" {
description = "Subscriber-assigned project ID"
type = string
default = ""
}
variable "bandwidth" {
description = "Connection bandwidth in Mbps"
type = number
Expand All @@ -43,11 +48,6 @@ variable "aside_fcr_uuid" {
description = "Equinix-assigned Fabric Cloud Router identifier"
type = string
}
variable "zside_ap_authentication_key" {
description = "Authentication key for provider based connections"
type = string
sensitive = true
}
variable "zside_ap_type" {
description = "Access point type - COLO, VD, VG, SP, IGW, SUBNET, GW"
type = string
Expand All @@ -67,13 +67,68 @@ variable "zside_peering_type" {
description = "Access point peering type - PRIVATE, MICROSOFT, PUBLIC, MANUAL"
default = "PRIVATE"
}
variable "zside_seller_region" {
description = "Access point seller region"
type = string
default = ""
}
variable "zside_fabric_sp_name" {
description = "Equinix Service Profile Name"
type = string
default = ""
}
variable "oracle_tenancy_ocid" {
description = "Tenancy OCID"
type = string
sensitive = true
}
variable "oracle_user_ocid" {
description = "User OCID"
type = string
sensitive = true
}
variable "oracle_private_key" {
description = "Oracle Private Key"
type = string
}
variable "oracle_fingerprint" {
description = "Fingerprint for the key pair being used"
type = string
sensitive = true
}
variable "oracle_region" {
description = "OCI region"
type = string
}
variable "oracle_compartment_id" {
description = "The OCID of the compartment"
type = string
sensitive = true
}
variable "oracle_fastconnect_provider" {
description = "Fast Connect Provider Name"
type = string
}
variable "oracle_vc_display_name" {
description = "OCI Virtual Circuit Name"
type = string
}
variable "oracle_vc_type" {
description = "The type of IP addresses used in this virtual circuit - PRIVATE"
type = string
}
variable "oracle_bandwidth" {
description = "The provisioned connection bandwidth"
type = string
}
variable "oracle_customer_bgp_peering_ip" {
description = "The BGP IPv4 address for the router on the other end of the BGP session from Oracle"
type = string
}
variable "oracle_bgp_peering_ip" {
description = "The BGP IPv6 address for the router on the other end of the BGP session from Oracle"
type = string
}
variable "oracle_customer_asn" {
description = "Oracle BGP ASN"
type = string
}
variable "oracle_gateway_id" {
description = "The OCID of the dynamic routing gateway (DRG) that virtual circuit uses"
type = string
}
4 changes: 4 additions & 0 deletions examples/cloud-router-2-oracle-connection/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,9 @@ terraform {
source = "equinix/equinix"
version = ">= 1.20.0"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to change the version for all examples to use the version that includes your WaitForDeprovision changes. The versions before that won't work for these examples.

}
oci = {
source = "oracle/oci"
version = "5.36.0"
}
}
}
43 changes: 41 additions & 2 deletions examples/metal-nimf-2-oracle-connection/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@ provider "equinix" {
client_secret = var.equinix_client_secret
auth_token = var.metal_auth_token
}
provider "oci" {
tenancy_ocid = var.oracle_tenancy_ocid
user_ocid = var.oracle_user_ocid
private_key = var.oracle_private_key
fingerprint = var.oracle_fingerprint
region = var.oracle_region
}

resource "equinix_metal_vlan" "vlan-server" {
description = "${var.metal_connection_metro} VLAN Server 1 to Cloud"
metro = var.metal_connection_metro
Expand All @@ -19,6 +27,35 @@ resource "equinix_metal_connection" "metal-connection" {
contact_email = var.metal_contact_email
}

data "oci_core_fast_connect_provider_services" "fc_provider_services" {
compartment_id = var.oracle_compartment_id
}

locals {
fc_provider_services_id = element(
data.oci_core_fast_connect_provider_services.fc_provider_services.fast_connect_provider_services,
index(
data.oci_core_fast_connect_provider_services.fc_provider_services.fast_connect_provider_services.*.provider_name,
var.oracle_fastconnect_provider
)
).id
}

resource "oci_core_virtual_circuit" "test_virtual_circuit" {
display_name = var.oracle_vc_display_name
compartment_id = var.oracle_compartment_id
type = var.oracle_vc_type
bandwidth_shape_name = var.oracle_bandwidth
cross_connect_mappings {
customer_bgp_peering_ip = var.oracle_customer_bgp_peering_ip
oracle_bgp_peering_ip = var.oracle_bgp_peering_ip
}
customer_asn = var.oracle_customer_asn
region = var.oracle_region
provider_service_id = local.fc_provider_services_id
gateway_id = var.oracle_gateway_id
}

module "metal_2_oracle_connection" {
source = "../../modules/metal-connection"

Expand All @@ -30,12 +67,14 @@ module "metal_2_oracle_connection" {
bandwidth = var.bandwidth
purchase_order_number = var.purchase_order_number

#A-side
aside_ap_authentication_key = equinix_metal_connection.metal-connection.authorization_code

#Z-side
zside_ap_type = var.zside_ap_type
zside_ap_authentication_key = var.zside_ap_authentication_key
zside_ap_authentication_key = oci_core_virtual_circuit.test_virtual_circuit.id
zside_ap_profile_type = var.zside_ap_profile_type
zside_location = var.zside_location
zside_seller_region = var.zside_seller_region
zside_seller_region = var.oracle_region
zside_fabric_sp_name = var.zside_fabric_sp_name
}
17 changes: 15 additions & 2 deletions examples/metal-nimf-2-oracle-connection/terraform.tfvars.example
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,22 @@ notifications_emails = ["[email protected]"]
bandwidth = 50
purchase_order_number = "1-323292"
project_id = "<Project_ID>"
zside_ap_authentication_key = "<Oracle Service Key>"
zside_ap_type = "SP"
zside_ap_profile_type = "L2_PROFILE"
zside_location = "SV"
zside_seller_region = "us-sanjose-1"
zside_fabric_sp_name = "Oracle Cloud Infrastructure FastConnect"

oracle_tenancy_ocid = "<Oracle Tenancy OCID>"
oracle_user_ocid = "<Oracle User OCID>"
oracle_private_key = "<Oracle Private Key>"
oracle_fingerprint = "<Oracle Fingerprint>"
oracle_region = "us-sanjose-1"
oracle_compartment_id = "<Oracle Compartment ID>",
oracle_fastconnect_provider = "Equinix"
oracle_vc_display_name = "Metal2Oracle"
oracle_vc_type = "PRIVATE"
oracle_bandwidth = "1 Gbps"
oracle_customer_bgp_peering_ip = "10.1.0.50/30"
oracle_bgp_peering_ip = "10.1.0.49/30"
oracle_customer_asn = "123456"
oracle_gateway_id = "<Oracle Gateway ID>"
Loading
Loading