Improve beta documentation (#414)

* replace BETA with beta

* improve beta error text

* remove reference to guide
This commit is contained in:
Diogo Ferrão 2024-06-21 13:25:49 +01:00 committed by GitHub
parent a07ff3f9ba
commit 50d74e6695
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 8 deletions

View file

@ -10,7 +10,7 @@ import (
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/core"
)
// BetaResourcesEnabled returns whether this provider has BETA functionality enabled.
// BetaResourcesEnabled returns whether this provider has beta functionality enabled.
//
// In order of precedence, beta functionality can be managed by:
// - Environment Variable `STACKIT_TF_ENABLE_BETA_RESOURCES` - `true` is enabled, `false` is disabled.
@ -24,7 +24,7 @@ func BetaResourcesEnabled(ctx context.Context, data *core.ProviderData, diags *d
if strings.EqualFold(value, "false") {
return false
}
warnDetails := fmt.Sprintf(`The value of the environment variable that enables BETA functionality must be either "true" or "false", got %q.
warnDetails := fmt.Sprintf(`The value of the environment variable that enables beta functionality must be either "true" or "false", got %q.
Defaulting to the provider feature flag.`, value)
core.LogAndAddWarning(ctx, diags, "Invalid value for STACKIT_TF_ENABLE_BETA_RESOURCES environment variable.", warnDetails)
}
@ -35,9 +35,9 @@ Defaulting to the provider feature flag.`, value)
return data.EnableBetaResources
}
// CheckBetaResourcesEnabled is a helper function to log and add a warning or error if the BETA functionality is not enabled.
// CheckBetaResourcesEnabled is a helper function to log and add a warning or error if the beta functionality is not enabled.
//
// Should be called in the Configure method of a BETA resource.
// Should be called in the Configure method of a beta resource.
// Then, check for Errors in the diags using the diags.HasError() method.
func CheckBetaResourcesEnabled(ctx context.Context, data *core.ProviderData, diags *diag.Diagnostics, resourceName string) {
if !BetaResourcesEnabled(ctx, data, diags) {