fix(beta): remove caching of beta checks (#757)

beta checks caused issues when debugging

relates to STACKITTPR-206
This commit is contained in:
Ruben Hönle 2025-04-07 09:17:35 +02:00 committed by GitHub
parent d6749b6ce3
commit 7cc9ca4fd4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 18 additions and 66 deletions

View file

@ -30,11 +30,6 @@ import (
"github.com/stackitcloud/stackit-sdk-go/services/serverupdate"
)
// resourceBetaCheckDone is used to prevent multiple checks for beta resources.
// This is a workaround for the lack of a global state in the provider and
// needs to exist because the Configure method is called twice.
var resourceBetaCheckDone bool
// Ensure the implementation satisfies the expected interfaces.
var (
_ resource.Resource = &scheduleResource{}
@ -115,12 +110,9 @@ func (r *scheduleResource) Configure(ctx context.Context, req resource.Configure
return
}
if !resourceBetaCheckDone {
features.CheckBetaResourcesEnabled(ctx, &r.providerData, &resp.Diagnostics, "stackit_server_update_schedule", "resource")
if resp.Diagnostics.HasError() {
return
}
resourceBetaCheckDone = true
features.CheckBetaResourcesEnabled(ctx, &r.providerData, &resp.Diagnostics, "stackit_server_update_schedule", "resource")
if resp.Diagnostics.HasError() {
return
}
var apiClient *serverupdate.APIClient