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

chore(dep): Updated fabric-go sdk usage for new fabric-go v0.7.0 version #410

Merged
merged 5 commits into from
Oct 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
14 changes: 7 additions & 7 deletions equinix/resource_fabric_cloud_router.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func resourceCloudRouterCreate(ctx context.Context, d *schema.ResourceData, meta
Project: &project,
}

fcr, _, err := client.CloudRoutersApi.CreateGateway(ctx, createRequest)
fcr, _, err := client.CloudRoutersApi.CreateCloudRouter(ctx, createRequest)
if err != nil {
return diag.FromErr(err)
}
Expand All @@ -80,7 +80,7 @@ func resourceCloudRouterCreate(ctx context.Context, d *schema.ResourceData, meta
func resourceCloudRouterRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics {
client := meta.(*Config).fabricClient
ctx = context.WithValue(ctx, v4.ContextAccessToken, meta.(*Config).FabricAuthToken)
CloudRouter, _, err := client.CloudRoutersApi.GetGatewayByUuid(ctx, d.Id())
CloudRouter, _, err := client.CloudRoutersApi.GetCloudRouterByUuid(ctx, d.Id())
if err != nil {
log.Printf("[WARN] Fabric Cloud Router %s not found , error %s", d.Id(), err)
if !strings.Contains(err.Error(), "500") {
Expand Down Expand Up @@ -128,7 +128,7 @@ func resourceCloudRouterUpdate(ctx context.Context, d *schema.ResourceData, meta
return diag.FromErr(err)
}
updates := []v4.CloudRouterChangeOperation{update}
_, res, err := client.CloudRoutersApi.UpdateGatewayByUuid(ctx, updates, d.Id())
_, res, err := client.CloudRoutersApi.UpdateCloudRouterByUuid(ctx, updates, d.Id())
if err != nil {
return diag.FromErr(fmt.Errorf("error response for the Fabric Cloud Router update, response %v, error %v", res, err))
}
Expand All @@ -152,7 +152,7 @@ func waitForCloudRouterUpdateCompletion(uuid string, meta interface{}, ctx conte
Target: []string{string(v4.PROVISIONED_CloudRouterAccessPointState)},
Refresh: func() (interface{}, string, error) {
client := meta.(*Config).fabricClient
dbConn, _, err := client.CloudRoutersApi.GetGatewayByUuid(ctx, uuid)
dbConn, _, err := client.CloudRoutersApi.GetCloudRouterByUuid(ctx, uuid)
if err != nil {
return "", "", err
}
Expand Down Expand Up @@ -184,7 +184,7 @@ func waitUntilCloudRouterIsProvisioned(uuid string, meta interface{}, ctx contex
},
Refresh: func() (interface{}, string, error) {
client := meta.(*Config).fabricClient
dbConn, _, err := client.CloudRoutersApi.GetGatewayByUuid(ctx, uuid)
dbConn, _, err := client.CloudRoutersApi.GetCloudRouterByUuid(ctx, uuid)
if err != nil {
return "", "", err
}
Expand All @@ -208,7 +208,7 @@ func resourceCloudRouterDelete(ctx context.Context, d *schema.ResourceData, meta
diags := diag.Diagnostics{}
client := meta.(*Config).fabricClient
ctx = context.WithValue(ctx, v4.ContextAccessToken, meta.(*Config).FabricAuthToken)
resp, err := client.CloudRoutersApi.DeleteGatewayByUuid(ctx, d.Id())
resp, err := client.CloudRoutersApi.DeleteCloudRouterByUuid(ctx, d.Id())
if err != nil {
errors, ok := err.(v4.GenericSwaggerError).Model().([]v4.ModelError)
if ok {
Expand Down Expand Up @@ -238,7 +238,7 @@ func waitUntilCloudRouterDeprovisioned(uuid string, meta interface{}, ctx contex
},
Refresh: func() (interface{}, string, error) {
client := meta.(*Config).fabricClient
dbConn, _, err := client.CloudRoutersApi.GetGatewayByUuid(ctx, uuid)
dbConn, _, err := client.CloudRoutersApi.GetCloudRouterByUuid(ctx, uuid)
if err != nil {
return "", "", err
}
Expand Down
2 changes: 1 addition & 1 deletion equinix/resource_fabric_service_profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ func resourceServiceProfilesSearchRequest(ctx context.Context, d *schema.Resourc
Filter: &serviceProfileFlt,
Sort: sort,
}
serviceProfiles, _, err := client.ServiceProfilesApi.SearchServiceProfiles(ctx, createServiceProfilesSearchRequest)
serviceProfiles, _, err := client.ServiceProfilesApi.SearchServiceProfiles(ctx, createServiceProfilesSearchRequest, nil)
if err != nil {
if !strings.Contains(err.Error(), "500") {
error := v4.ModelError{}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ provider "equinix" {
client_secret = var.equinix_client_secret
}

data "equinix_fabric_service_profiles" "azure"{
filter{
data "equinix_fabric_service_profiles" "azure" {
filter {
property = "/name"
operator = "="
values = [var.fabric_sp_name]
values = [var.fabric_sp_name]
}
}

resource "equinix_fabric_connection" "fcr2azure"{
resource "equinix_fabric_connection" "fcr2azure" {
name = var.pri_connection_name
type = var.connection_type

Expand Down Expand Up @@ -52,7 +52,7 @@ resource "equinix_fabric_connection" "fcr2azure"{
}
}

resource "equinix_fabric_connection" "fcr2azure2"{
resource "equinix_fabric_connection" "fcr2azure2" {
name = var.sec_connection_name

type = var.connection_type
Expand All @@ -70,7 +70,7 @@ resource "equinix_fabric_connection" "fcr2azure2"{
*/
redundancy {
priority = "SECONDARY"
group = one(equinix_fabric_connection.fcr2azure.redundancy).group
group = one(equinix_fabric_connection.fcr2azure.redundancy).group
}
order {
purchase_order_number = var.sec_purchase_order_number
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
equinix_client_id = "Equinix_Client_Id"
equinix_client_secret = "Equinix_Client_Secret"
pri_connection_name = "fcr_2_azure_pri"
sec_connection_name = "fcr_2_azure_sec"
connection_type = "IP_VC"
notifications_type = "ALL"
notifications_emails = ["[email protected]"]
bandwidth = 50
pri_purchase_order_number = "1-323202"
sec_purchase_order_number = "1-323292"
peering_type="PRIVATE"
aside_ap_type = "CLOUD_ROUTER"
cloud_router_primary_uuid = "19514e72-f1c0-497c-a550-664aa75cb28c"
equinix_client_id = "Equinix_Client_Id"
equinix_client_secret = "Equinix_Client_Secret"
pri_connection_name = "fcr_2_azure_pri"
sec_connection_name = "fcr_2_azure_sec"
connection_type = "IP_VC"
notifications_type = "ALL"
notifications_emails = ["[email protected]"]
bandwidth = 50
pri_purchase_order_number = "1-323202"
sec_purchase_order_number = "1-323292"
peering_type = "PRIVATE"
aside_ap_type = "CLOUD_ROUTER"
cloud_router_primary_uuid = "19514e72-f1c0-497c-a550-664aa75cb28c"
cloud_router_secondary_uuid = "56cfbf37-2ffd-4dac-b797-782bb5f459fc"
zside_ap_type = "SP"
zside_ap_type = "SP"
zside_ap_authentication_key = "Azure Service Key"
zside_ap_profile_type = "L2_PROFILE"
zside_location = "SV"
fabric_sp_name = "Azure ExpressRoute"
zside_ap_profile_type = "L2_PROFILE"
zside_location = "SV"
fabric_sp_name = "Azure ExpressRoute"
Original file line number Diff line number Diff line change
Expand Up @@ -4,34 +4,34 @@ provider "equinix" {
}


resource "equinix_fabric_connection" "fcr2ipwan"{
resource "equinix_fabric_connection" "fcr2ipwan" {
name = var.connection_name
type = var.connection_type
notifications{
type=var.notifications_type
emails=var.notifications_emails
notifications {
type = var.notifications_type
emails = var.notifications_emails
}
bandwidth = var.bandwidth

order {
purchase_order_number= var.purchase_order_number
purchase_order_number = var.purchase_order_number
}
a_side {
access_point {
type= var.aside_ap_type
type = var.aside_ap_type
router {
uuid= var.fcr_uuid
uuid = var.fcr_uuid
}
}
}
z_side {
z_side {
access_point {
type = var.zside_ap_type
network {
uuid = var.network_uuid
}
}
}
}
}

output "connection_result" {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
equinix_client_id = ""
equinix_client_secret = ""
notifications_type = "ALL"
notifications_emails = ["[email protected]", "[email protected]"]
purchase_order_number = "1-323292"
fcr_uuid = "<fcr-uuid>"
connection_name = "terraform_fcr2wan"
connection_type = "IPWAN_VC"
bandwidth = 50
aside_ap_type = "CLOUD_ROUTER"
zside_ap_type = "NETWORK"
network_uuid = "<network-uuid>"
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ provider "equinix" {
client_secret = var.equinix_client_secret
}

resource "equinix_fabric_cloud_router" "test"{
resource "equinix_fabric_cloud_router" "test" {
name = var.fcr_name
type = var.fcr_type
notifications{
type =var.notifications_type
emails =var.notifications_emails
notifications {
type = var.notifications_type
emails = var.notifications_emails
}
order {
purchase_order_number = var.purchase_order_number
Expand All @@ -22,24 +22,24 @@ resource "equinix_fabric_cloud_router" "test"{
project {
project_id = var.fcr_project
}
account {
account {
account_number = var.fcr_account
}
}
}

output "fcr_result" {
value = equinix_fabric_cloud_router.test.id
}

data "equinix_fabric_service_profiles" "azure"{
filter{
data "equinix_fabric_service_profiles" "azure" {
filter {
property = "/name"
operator = "="
values = [var.azure_fabric_sp_name]
}
}

resource "equinix_fabric_connection" "fcr2azure"{
resource "equinix_fabric_connection" "fcr2azure" {
name = var.azure_connection_name
type = var.azure_connection_type

Expand Down Expand Up @@ -85,14 +85,14 @@ output "azure_connection_id" {
value = equinix_fabric_connection.fcr2azure.id
}

resource "equinix_fabric_routing_protocol" "azure-direct-protocol"{
resource "equinix_fabric_routing_protocol" "azure-direct-protocol" {
connection_uuid = equinix_fabric_connection.fcr2azure.id
type = var.azure_rp_type
name = var.azure_rp_name
direct_ipv4 {
equinix_iface_ip = var.azure_equinix_ipv4_ip
}
direct_ipv6{
direct_ipv6 {
equinix_iface_ip = var.azure_equinix_ipv6_ip
}
}
Expand All @@ -114,7 +114,7 @@ resource "equinix_fabric_routing_protocol" "azure-bgp-protocol" {
enabled = var.azure_bgp_enabled_ipv6
}
customer_asn = var.azure_bgp_customer_asn
depends_on = [equinix_fabric_routing_protocol.azure-direct-protocol]
depends_on = [equinix_fabric_routing_protocol.azure-direct-protocol]
}

output "azure_rp_bgp_id" {
Expand All @@ -130,16 +130,16 @@ data "equinix_fabric_service_profiles" "aws" {
}
}

resource "equinix_fabric_connection" "fcr2aws"{
resource "equinix_fabric_connection" "fcr2aws" {
name = var.aws_connection_name
type = var.aws_connection_type
notifications{
notifications {
type = var.aws_notifications_type
emails = var.aws_notifications_emails
}
additional_info = [{"key"= "accessKey", "value"= var.aws_access_key }, {"key"= "secretKey", "value"= var.aws_secret_key }]
additional_info = [{ "key" = "accessKey", "value" = var.aws_access_key }, { "key" = "secretKey", "value" = var.aws_secret_key }]
bandwidth = var.aws_bandwidth
redundancy {priority = var.aws_redundancy}
redundancy { priority = var.aws_redundancy }
order {
purchase_order_number = var.aws_purchase_order_number
}
Expand All @@ -153,9 +153,9 @@ resource "equinix_fabric_connection" "fcr2aws"{
}
z_side {
access_point {
type = var.aws_zside_ap_type
type = var.aws_zside_ap_type
authentication_key = var.aws_zside_ap_authentication_key
seller_region = var.aws_seller_region
seller_region = var.aws_seller_region
profile {
type = var.aws_zside_ap_profile_type
uuid = data.equinix_fabric_service_profiles.aws.id
Expand All @@ -175,16 +175,16 @@ output "aws_connection_id" {
value = equinix_fabric_connection.fcr2aws.id
}

resource "equinix_fabric_routing_protocol" "aws-direct-protocol"{
resource "equinix_fabric_routing_protocol" "aws-direct-protocol" {
connection_uuid = equinix_fabric_connection.fcr2aws.id
type = var.aws_rp_type
name = var.aws_rp_name
type = var.aws_rp_type
name = var.aws_rp_name
direct_ipv4 {
equinix_iface_ip = var.aws_equinix_ipv4_ip
}
direct_ipv6{
equinix_iface_ip = var.aws_equinix_ipv6_ip
}
direct_ipv6 {
equinix_iface_ip = var.aws_equinix_ipv6_ip
}
}

output "aws_rp_direct_id" {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
equinix_client_id = "MyEquinixClientId"
equinix_client_secret = "MyEquinixSecret"
equinix_client_id = "MyEquinixClientId"
equinix_client_secret = "MyEquinixSecret"

#FCR
fcr_name = "TERA_E2E_FCR"
fcr_type = "XF_ROUTER"
notifications_type = "ALL"
notifications_emails = ["[email protected]","[email protected]"]
notifications_emails = ["[email protected]", "[email protected]"]
purchase_order_number = "1-323290"
fcr_location = "SV"
fcr_package = "PRO"
Expand Down Expand Up @@ -48,7 +48,7 @@ azure_bgp_customer_asn = "100"
aws_connection_name = "FCR_2_AWS"
aws_connection_type = "IP_VC"
aws_notifications_type = "ALL"
aws_notifications_emails = ["[email protected]","[email protected]"]
aws_notifications_emails = ["[email protected]", "[email protected]"]
aws_purchase_order_number = "1-323293"
aws_bandwidth = 50
aws_redundancy = "SECONDARY"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,13 @@ variable "azure_notifications_type" {}
variable "azure_notifications_emails" {}
variable "azure_bandwidth" {}
variable "azure_redundancy" {}
variable "azure_redundancy_group_uuid" {}
variable "azure_purchase_order_number" {}
variable "azure_peering_type" {}
variable "azure_aside_ap_type" {}

variable "azure_zside_ap_type" {}
variable "azure_zside_ap_authentication_key" {}
variable "azure_zside_ap_profile_type" {}
variable "azure_zside_ap_profile_uuid" {}
variable "azure_zside_location" {}
variable "azure_fabric_sp_name" {}

Expand Down
Loading
Loading