From 414e429dc517f91b9979e43553f9971b8d236ac4 Mon Sep 17 00:00:00 2001 From: Samsondeen Dare Date: Thu, 17 Oct 2024 22:43:11 +0200 Subject: [PATCH] remove external_id, spurious fix --- registry_module.go | 10 +++++----- registry_module_integration_test.go | 4 ++-- tfe.go | 7 +------ 3 files changed, 8 insertions(+), 13 deletions(-) diff --git a/registry_module.go b/registry_module.go index f3ebbfffd..67bf1fa12 100644 --- a/registry_module.go +++ b/registry_module.go @@ -111,8 +111,8 @@ const ( // Use NewPublicRegistryModuleID or NewPrivateRegistryModuleID to build one type RegistryModuleID struct { - // The unique external ID of the organization. If given, the other fields are ignored. - ExternalID string + // The unique ID of the module. If given, the other fields are ignored. + ID string // The organization the module belongs to, see RegistryModule.Organization.Name Organization string // The name of the module, see RegistryModule.Name @@ -527,7 +527,7 @@ func (r *registryModules) Read(ctx context.Context, moduleID RegistryModuleID) ( } var u string - if moduleID.ExternalID == "" { + if moduleID.ID == "" { if moduleID.RegistryName == "" { log.Println("[WARN] Support for using the RegistryModuleID without RegistryName is deprecated as of release 1.5.0 and may be removed in a future version. The preferred method is to include the RegistryName in RegistryModuleID.") moduleID.RegistryName = PrivateRegistry @@ -547,7 +547,7 @@ func (r *registryModules) Read(ctx context.Context, moduleID RegistryModuleID) ( url.PathEscape(moduleID.Provider), ) } else { - u = fmt.Sprintf("registry-modules/%s", url.PathEscape(moduleID.ExternalID)) + u = fmt.Sprintf("registry-modules/%s", url.PathEscape(moduleID.ID)) } req, err := r.client.NewRequest("GET", u, nil) @@ -698,7 +698,7 @@ func (r *registryModules) DeleteVersion(ctx context.Context, moduleID RegistryMo } func (o RegistryModuleID) valid() error { - if validString(&o.ExternalID) && validStringID(&o.ExternalID) { + if validString(&o.ID) && validStringID(&o.ID) { return nil } diff --git a/registry_module_integration_test.go b/registry_module_integration_test.go index 5dffffd60..c33222e01 100644 --- a/registry_module_integration_test.go +++ b/registry_module_integration_test.go @@ -1193,9 +1193,9 @@ func TestRegistryModulesRead(t *testing.T) { }) }) - t.Run("with a external ID field for private module", func(t *testing.T) { + t.Run("with a unique ID field for private module", func(t *testing.T) { rm, err := client.RegistryModules.Read(ctx, RegistryModuleID{ - ExternalID: registryModuleTest.ID, + ID: registryModuleTest.ID, }) require.NoError(t, err) require.NotEmpty(t, rm) diff --git a/tfe.go b/tfe.go index d91432aa3..a4f40be3e 100644 --- a/tfe.go +++ b/tfe.go @@ -319,12 +319,7 @@ func (c *Client) NewRequestWithAdditionalQueryParams(method, path string, reqBod q[k] = v } - encodedParams := encodeQueryParams(q) - if u.RawQuery == "" { - u.RawQuery = encodedParams - } else if encodedParams != "" { - u.RawQuery = strings.Join([]string{u.RawQuery, encodedParams}, "&") - } + u.RawQuery = encodeQueryParams(q) req, err := retryablehttp.NewRequest(method, u.String(), body) if err != nil {