Skip to content

Commit

Permalink
Merge pull request #819 from hashicorp/bugfix/cli-auth-tenant-id
Browse files Browse the repository at this point in the history
Bugfix: set the tenant ID correctly when not specified by provider block
  • Loading branch information
manicminer authored Jun 10, 2022
2 parents 2cad793 + b9d2c7e commit f448d77
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions internal/clients/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,6 @@ func (b *ClientBuilder) Build(ctx context.Context) (*Client, error) {

client.Environment = b.AuthConfig.Environment

o := &common.ClientOptions{
Authorizer: authorizer,
Environment: client.Environment,
TenantID: client.TenantID,

PartnerID: b.PartnerID,
TerraformVersion: client.TerraformVersion,
}

// Obtain the tenant ID from Azure CLI
realAuthorizer := authorizer
if cache, ok := authorizer.(*auth.CachedAuthorizer); ok {
Expand All @@ -60,6 +51,15 @@ func (b *ClientBuilder) Build(ctx context.Context) (*Client, error) {
}
}

o := &common.ClientOptions{
Authorizer: authorizer,
Environment: client.Environment,
TenantID: client.TenantID,

PartnerID: b.PartnerID,
TerraformVersion: client.TerraformVersion,
}

if err := client.build(ctx, o); err != nil {
return nil, fmt.Errorf("building client: %+v", err)
}
Expand Down

0 comments on commit f448d77

Please sign in to comment.