Skip to content

Commit 93422f3

Browse files
Handle basepath overrides in Vertex (#16783)
[upstream:c7cbd65591814881d61b20bd5484eda92fd1f414] Signed-off-by: Modular Magician <[email protected]>
1 parent 24f999e commit 93422f3

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

.changelog/16783.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:bug
2+
vertexai: fixed operation calls in `google_vertex_ai_` resources not respecting `universe_domain` and `vertex_custom_endpoint`
3+
```

google-beta/services/vertexai/vertex_ai_operation.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
//
99
// This code is generated by Magic Modules using the following:
1010
//
11-
// Source file: https://github.com/GoogleCloudPlatform/magic-modules/tree/main/mmv1/third_party/terraform/services/vertexai/vertex_ai_operation.go.tmpl
11+
// Source file: https://github.com/GoogleCloudPlatform/magic-modules/tree/main/mmv1/third_party/terraform/services/vertexai/vertex_ai_operation.go
1212
//
1313
// DO NOT EDIT this file directly. Any changes made to this file will be
1414
// overwritten during the next generation cycle.
@@ -19,6 +19,7 @@ package vertexai
1919
import (
2020
"encoding/json"
2121
"fmt"
22+
"strings"
2223
"time"
2324

2425
"github.com/hashicorp/terraform-provider-google-beta/google-beta/tpgresource"
@@ -37,10 +38,11 @@ func (w *VertexAIOperationWaiter) QueryOp() (interface{}, error) {
3738
return nil, fmt.Errorf("Cannot query operation, it's unset or nil.")
3839
}
3940

41+
// Replace any occurences of the `{{region}}` tag with `region` directly.
42+
// ReplaceVars can't be used because we don't have all of the necessary inputs.
4043
region := tpgresource.GetRegionFromRegionalSelfLink(w.CommonOperationWaiter.Op.Name)
41-
42-
// Returns the proper get.
43-
url := fmt.Sprintf("https://%s-aiplatform.googleapis.com/v1beta1/%s", region, w.CommonOperationWaiter.Op.Name)
44+
baseUrl := strings.ReplaceAll(w.Config.VertexAIBasePath, "{{region}}", region)
45+
url := fmt.Sprintf("%s%s", baseUrl, w.CommonOperationWaiter.Op.Name)
4446

4547
return transport_tpg.SendRequest(transport_tpg.SendRequestOptions{
4648
Config: w.Config,

0 commit comments

Comments
 (0)