fix provider context

This commit is contained in:
Jan Husak
2025-11-11 13:53:29 +01:00
parent 0f2a12d84f
commit be79b657d2
2 changed files with 4 additions and 11 deletions

View File

@@ -65,12 +65,9 @@ func (p *bitbucketTokenProvider) Configure(ctx context.Context, req provider.Con
return
}
serverURL := config.ServerURL.ValueString()
authHeader := config.AuthHeader.ValueString()
providerData := ProviderData{
AuthHeader: authHeader,
ServerURL: serverURL,
providerData := &ProviderData{
AuthHeader: config.AuthHeader.ValueString(),
ServerURL: config.ServerURL.ValueString(),
}
resp.DataSourceData = providerData

View File

@@ -70,14 +70,10 @@ func (r *BitbucketTokenResource) Schema(_ context.Context, req resource.SchemaRe
func (r *BitbucketTokenResource) Configure(ctx context.Context, req resource.ConfigureRequest, resp *resource.ConfigureResponse) {
if req.ProviderData == nil {
resp.Diagnostics.AddError(
"Missing provider configuration",
"The Bitbucket provider was not configured before using this resource.",
)
return
}
providerData, ok := req.ProviderData.(ProviderData)
providerData, ok := req.ProviderData.(*ProviderData)
if !ok {
resp.Diagnostics.AddError(
"Unexpected Provider Data Type",