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

rebase upstream #31

Closed
wants to merge 4 commits into from
Closed
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
2 changes: 2 additions & 0 deletions go.work.sum
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,8 @@ github.com/elazarl/goproxy/ext v0.0.0-20190711103511-473e67f1d7d2 h1:dWB6v3RcOy0
github.com/emicklei/go-restful v2.9.5+incompatible h1:spTtZBk5DYEvbxMVutUuTyh1Ao2r4iyvLdACqsl/Ljk=
github.com/envoyproxy/go-control-plane v0.11.1-0.20230524094728-9239064ad72f h1:7T++XKzy4xg7PKy+bM+Sa9/oe1OC88yz2hXQUISoXfA=
github.com/envoyproxy/protoc-gen-validate v0.10.1 h1:c0g45+xCJhdgFGw7a5QAfdS4byAbud7miNWJ1WwEVf8=
github.com/equinix-labs/metal-go v0.25.1 h1:uL83lRKyAcOfab+9r2xujAuLD8lTsqv89+SPvVFkcBM=
github.com/equinix-labs/metal-go v0.25.1/go.mod h1:SmxCklxW+KjmBLVMdEXgtFO5gD5/b4N0VxcNgUYbOH4=
github.com/evanphx/json-patch v4.12.0+incompatible h1:4onqiflcdA9EOZ4RxV643DvftH5pOlLGNtQ5lPWQu84=
github.com/evanphx/json-patch/v5 v5.5.0 h1:bAmFiUJ+o0o2B4OiTFeE3MqCOtyo+jjPP9iZ0VRxYUc=
github.com/felixge/httpsnoop v1.0.3 h1:s/nj+GCswXYzN5v2DpNMuMQYe+0DDwt5WVCU6CWBdXk=
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: ocobleseqx <[email protected]>
Date: Thu, 26 Oct 2023 13:47:05 +0200
Subject: [PATCH 1/7] ignore empty order block and set max 1 for project block

Signed-off-by: ocobleseqx <[email protected]>

diff --git a/equinix/fabric_cloud_router_schema.go b/equinix/fabric_cloud_router_schema.go
index 0bc416e..402c4c3 100755
--- a/equinix/fabric_cloud_router_schema.go
+++ b/equinix/fabric_cloud_router_schema.go
@@ -118,6 +118,7 @@ func createCloudRouterResourceSchema() map[string]*schema.Schema {
Type: schema.TypeSet,
Optional: true,
Description: "Fabric Cloud Router project",
+ MaxItems: 1,
Elem: &schema.Resource{
Schema: createCloudRouterProjectSch(),
},
diff --git a/equinix/resource_fabric_cloud_router.go b/equinix/resource_fabric_cloud_router.go
index 1f72db4..ed67ab8 100755
--- a/equinix/resource_fabric_cloud_router.go
+++ b/equinix/resource_fabric_cloud_router.go
@@ -39,8 +39,6 @@ func resourceCloudRouterCreate(ctx context.Context, d *schema.ResourceData, meta
ctx = context.WithValue(ctx, v4.ContextAccessToken, meta.(*Config).FabricAuthToken)
schemaNotifications := d.Get("notifications").([]interface{})
notifications := notificationToFabric(schemaNotifications)
- schemaOrder := d.Get("order").(*schema.Set).List()
- order := orderToFabric(schemaOrder)
schemaAccount := d.Get("account").(*schema.Set).List()
account := accountToCloudRouter(schemaAccount)
schemaLocation := d.Get("location").(*schema.Set).List()
@@ -56,7 +54,6 @@ func resourceCloudRouterCreate(ctx context.Context, d *schema.ResourceData, meta
createRequest := v4.CloudRouterPostRequest{
Name: d.Get("name").(string),
Type_: d.Get("type").(string),
- Order: &order,
Location: &location,
Notifications: notifications,
Package_: &packages,
@@ -64,6 +61,11 @@ func resourceCloudRouterCreate(ctx context.Context, d *schema.ResourceData, meta
Project: &project,
}

+ if v, ok := d.GetOk("order"); ok {
+ order := orderToFabric(v.(*schema.Set).List())
+ createRequest.Order = &order
+ }
+
fcr, _, err := client.CloudRoutersApi.CreateCloudRouter(ctx, createRequest)
if err != nil {
return diag.FromErr(err)
49 changes: 0 additions & 49 deletions patches/0001-user-agent.patch

This file was deleted.

34 changes: 34 additions & 0 deletions patches/0002-chore-upgrade-metal-go-to-v0.25.1-431.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Charles Treatman <[email protected]>
Date: Fri, 27 Oct 2023 15:08:02 -0500
Subject: [PATCH 2/7] chore: upgrade metal-go to v0.25.1 (#431)


diff --git a/go.mod b/go.mod
index 568022f..468d567 100644
--- a/go.mod
+++ b/go.mod
@@ -5,7 +5,7 @@ go 1.20
require (
github.com/antihax/optional v1.0.0
github.com/equinix-labs/fabric-go v0.7.0
- github.com/equinix-labs/metal-go v0.16.0
+ github.com/equinix-labs/metal-go v0.25.1
github.com/equinix/ecx-go/v2 v2.3.1
github.com/equinix/ne-go v1.11.0
github.com/equinix/oauth2-go v1.0.0
diff --git a/go.sum b/go.sum
index f12dd80..01dba66 100644
--- a/go.sum
+++ b/go.sum
@@ -260,8 +260,8 @@ github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
github.com/equinix-labs/fabric-go v0.7.0 h1:AiiVPD4aE/aeiuCK7Fhsq4bvjmJ5RzmZ3boKnp0dl4g=
github.com/equinix-labs/fabric-go v0.7.0/go.mod h1:oqgGS3GOI8hHGPJKsAwDOEX0qRHl52sJGvwA/zMSd90=
-github.com/equinix-labs/metal-go v0.16.0 h1:4YmGx9SRFkDtHiEqRsSjlgJDztV6NHqH1eeaOZcK7d4=
-github.com/equinix-labs/metal-go v0.16.0/go.mod h1:SmxCklxW+KjmBLVMdEXgtFO5gD5/b4N0VxcNgUYbOH4=
+github.com/equinix-labs/metal-go v0.25.1 h1:uL83lRKyAcOfab+9r2xujAuLD8lTsqv89+SPvVFkcBM=
+github.com/equinix-labs/metal-go v0.25.1/go.mod h1:SmxCklxW+KjmBLVMdEXgtFO5gD5/b4N0VxcNgUYbOH4=
github.com/equinix/ecx-go/v2 v2.3.1 h1:gFcAIeyaEUw7S8ebqApmT7E/S7pC7Ac3wgScp89fkPU=
github.com/equinix/ecx-go/v2 v2.3.1/go.mod h1:FvCdZ3jXU8Z4CPKig2DT+4J2HdwgRK17pIcznM7RXyk=
github.com/equinix/ne-go v1.11.0 h1:ja6G2fmcGrLsOeV25Mq6pDfH+/cUlvxJbnE8uRXTGGk=
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Charles Treatman <[email protected]>
Date: Tue, 31 Oct 2023 09:43:08 -0500
Subject: [PATCH 3/7] fix: read metal-go client's auth token from config, not
env

When the metal-go client was introduced to enable packngo deprecation,
it was wired up directly to the `METAL_AUTH_TOKEN` environment variable
for auth. This breaks auth when a customer is using the `auth_token`
provider configuration.

This updates the metal-go client initialization so that the client will
work with both the `auth_token` setting and the `METAL_AUTH_TOKEN` env
var.

diff --git a/equinix/config.go b/equinix/config.go
index ebe0192..d59a4b9 100644
--- a/equinix/config.go
+++ b/equinix/config.go
@@ -228,7 +228,7 @@ func (c *Config) NewMetalGoClient() *metalv1.APIClient {
},
}
configuration.HTTPClient = standardClient
- configuration.AddDefaultHeader("X-Auth-Token", os.Getenv("METAL_AUTH_TOKEN"))
+ configuration.AddDefaultHeader("X-Auth-Token", c.AuthToken)
configuration.UserAgent = c.fullUserAgent(configuration.UserAgent)
client := metalv1.NewAPIClient(configuration)
c.metalGoUserAgent = client.GetConfig().UserAgent
Loading
Loading