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

Move endpoint default handling after TPC universe domain logic #16521

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
3 changes: 3 additions & 0 deletions .changelog/9463.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
provider: fixed an issue where universe domains would not overwrite API endpoints
```
7 changes: 6 additions & 1 deletion google/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -1729,7 +1729,6 @@ func ProviderConfigure(ctx context.Context, d *schema.ResourceData, p *schema.Pr
if err != nil {
return nil, diag.FromErr(err)
}
transport_tpg.HandleDCLCustomEndpointDefaults(d)

config := transport_tpg.Config{
Project: d.Get("project").(string),
Expand Down Expand Up @@ -1819,6 +1818,12 @@ func ProviderConfigure(ctx context.Context, d *schema.ResourceData, p *schema.Pr
}
}

err = transport_tpg.SetEndpointDefaults(d)
if err != nil {
return nil, diag.FromErr(err)
}
transport_tpg.HandleDCLCustomEndpointDefaults(d)

// Given that impersonate_service_account is a secondary auth method, it has
// no conflicts to worry about. We pull the env var in a DefaultFunc.
if v, ok := d.GetOk("impersonate_service_account"); ok {
Expand Down
3 changes: 3 additions & 0 deletions google/transport/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,10 @@ func HandleSDKDefaults(d *schema.ResourceData) error {
"CLOUDSDK_CORE_REQUEST_REASON",
}, nil))
}
return nil
}

func SetEndpointDefaults(d *schema.ResourceData) error {
// Generated Products
if d.Get("access_approval_custom_endpoint") == "" {
d.Set("access_approval_custom_endpoint", MultiEnvDefault([]string{
Expand Down