diff --git a/mmv1/third_party/terraform/fwtransport/framework_config.go.tmpl b/mmv1/third_party/terraform/fwtransport/framework_config.go.tmpl
index 21c61e0bf755..1ff25a60ee50 100644
--- a/mmv1/third_party/terraform/fwtransport/framework_config.go.tmpl
+++ b/mmv1/third_party/terraform/fwtransport/framework_config.go.tmpl
@@ -24,7 +24,6 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/logging"
"github.com/hashicorp/terraform-provider-google/google/fwmodels"
- iamcredentials "google.golang.org/api/iamcredentials/v1"
transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport"
"github.com/hashicorp/terraform-provider-google/google/verify"
@@ -533,12 +532,6 @@ func (p *FrameworkProviderConfig) SetupGrpcLogging() {
)
}
-// Remove the `/{{version}}/` from a base path if present.
-func RemoveBasePathVersion(url string) string {
- re := regexp.MustCompile(`(?Phttp[s]://.*)(?P/[^/]+?/$)`)
- return re.ReplaceAllString(url, "$1/")
-}
-
func (p *FrameworkProviderConfig) logGoogleIdentities(ctx context.Context, data fwmodels.ProviderModel, diags *diag.Diagnostics) {
// GetCurrentUserEmailFramework doesn't pass an error back from logGoogleIdentities, so we want
// a separate diagnostics here
diff --git a/mmv1/third_party/terraform/fwtransport/framework_provider_clients.go.tmpl b/mmv1/third_party/terraform/fwtransport/framework_provider_clients.go.tmpl
index bf2cb7804266..87e7c83b2b04 100644
--- a/mmv1/third_party/terraform/fwtransport/framework_provider_clients.go.tmpl
+++ b/mmv1/third_party/terraform/fwtransport/framework_provider_clients.go.tmpl
@@ -2,6 +2,7 @@ package fwtransport
import (
"fmt"
+ "log"
"strings"
"google.golang.org/api/dns/v1"
@@ -9,6 +10,7 @@ import (
firebase "google.golang.org/api/firebase/v1beta1"
{{- end }}
"google.golang.org/api/option"
+ iamcredentials "google.golang.org/api/iamcredentials/v1"
"github.com/hashicorp/terraform-plugin-framework/diag"
"github.com/hashicorp/terraform-plugin-log/tflog"
@@ -38,7 +40,7 @@ func (p *FrameworkProviderConfig) NewDnsClient(userAgent string, diags *diag.Dia
}
func (p *FrameworkProviderConfig) NewIamCredentialsClient(userAgent string) *iamcredentials.Service {
- iamCredentialsClientBasePath := RemoveBasePathVersion(p.IAMCredentialsBasePath)
+ iamCredentialsClientBasePath := transport_tpg.RemoveBasePathVersion(p.IAMCredentialsBasePath)
log.Printf("[INFO] Instantiating Google Cloud IAMCredentials client for path %s", iamCredentialsClientBasePath)
clientIamCredentials, err := iamcredentials.NewService(p.Context, option.WithHTTPClient(p.Client))
if err != nil {