Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
splits off the default API endpoint half of HandleSDKDefaults func into its own function and calls that new function after TPC universe domain is set. This allows the basepath defaults to use the new domain if set

The API custom/default endpoints are not used between when HandleSDKDefaults was called to after the TPC universe logic, so this reorder should be safe. HandleSDKDefaults is also not called anywhere else outside of the one use.

provider: fixed an issue where universe domains would not overwrite API endpoints

- [X] Run `make ready-pr` to ensure this PR is ready for review.
  • Loading branch information
cheftako committed Mar 21, 2024
1 parent dd54f7b commit 68a32da
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1945,7 +1945,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 @@ -2035,6 +2034,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
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,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

0 comments on commit 68a32da

Please sign in to comment.