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 #9463

Merged
merged 1 commit into from
Nov 13, 2023
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
Move endpoint default handling after TPC universe domain logic
  • Loading branch information
c2thorn committed Nov 13, 2023
commit 055ee274fa863eb6ef3428495d2ae090f644bf32
7 changes: 6 additions & 1 deletion mmv1/third_party/terraform/provider/provider.go.erb
Original file line number Diff line number Diff line change
Expand Up @@ -661,7 +661,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 @@ -755,6 +754,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 mmv1/third_party/terraform/transport/config.go.erb
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,10 @@ func HandleSDKDefaults(d *schema.ResourceData) error {
"CLOUDSDK_CORE_REQUEST_REASON",
}, nil))
}
return nil
}

func SetEndpointDefaults(d *schema.ResourceData) error {
// Generated Products
<% products.each do |product| -%>
if d.Get("<%= product[:definitions].name.underscore -%>_custom_endpoint") == "" {
Expand Down