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

omit /projects from compute basepath #5092

Merged
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
10 changes: 4 additions & 6 deletions mmv1/third_party/terraform/utils/config.go.erb
Original file line number Diff line number Diff line change
Expand Up @@ -349,29 +349,27 @@ func (c *Config) getTokenSource(clientScopes []string, initialCredentialsOnly bo
// of those "projects" as well. You can find out if this is required by looking at
// the basePath value in the client library file.
func (c *Config) NewComputeClient(userAgent string) *compute.Service {
computeClientBasePath := c.ComputeBasePath + "projects/"
log.Printf("[INFO] Instantiating GCE client for path %s", computeClientBasePath)
log.Printf("[INFO] Instantiating GCE client for path %s", c.ComputeBasePath)
clientCompute, err := compute.NewService(c.context, option.WithHTTPClient(c.client))
if err != nil {
log.Printf("[WARN] Error creating client compute: %s", err)
return nil
}
clientCompute.UserAgent = userAgent
clientCompute.BasePath = computeClientBasePath
clientCompute.BasePath = c.ComputeBasePath

return clientCompute
}

func (c *Config) NewComputeBetaClient(userAgent string) *computeBeta.Service {
computeBetaClientBasePath := c.ComputeBetaBasePath + "projects/"
log.Printf("[INFO] Instantiating GCE Beta client for path %s", computeBetaClientBasePath)
log.Printf("[INFO] Instantiating GCE Beta client for path %s", c.ComputeBetaBasePath)
clientComputeBeta, err := computeBeta.NewService(c.context, option.WithHTTPClient(c.client))
if err != nil {
log.Printf("[WARN] Error creating client compute beta: %s", err)
return nil
}
clientComputeBeta.UserAgent = userAgent
clientComputeBeta.BasePath = computeBetaClientBasePath
clientComputeBeta.BasePath = c.ComputeBetaBasePath

return clientComputeBeta
}
Expand Down