Skip to content

Commit

Permalink
provider: usign the passed-in context
Browse files Browse the repository at this point in the history
  • Loading branch information
tombuildsstuff committed Jun 18, 2021
1 parent 2d4d7bc commit 6be7043
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions azurerm/internal/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -321,17 +321,22 @@ func providerConfigure(p *schema.Provider) schema.ConfigureContextFunc {
// platform level tracing
CustomCorrelationRequestID: os.Getenv("ARM_CORRELATION_REQUEST_ID"),
}
client, err := clients.Build(context.TODO(), clientBuilder)

stopCtx, ok := schema.StopContext(ctx) //nolint:SA1019
if ok {
stopCtx = ctx
}

client, err := clients.Build(stopCtx, clientBuilder)
if err != nil {
return nil, diag.FromErr(err)
}

client.StopContext = context.TODO()
client.StopContext = stopCtx

if !skipProviderRegistration {
// List all the available providers and their registration state to avoid unnecessary
// requests. This also lets us check if the provider credentials are correct.
ctx := client.StopContext
providerList, err := client.Resource.ProvidersClient.List(ctx, nil, "")
if err != nil {
return nil, diag.FromErr(fmt.Errorf("Unable to list provider registration status, it is possible that this is due to invalid "+
Expand Down

0 comments on commit 6be7043

Please sign in to comment.