Support beta functionality (#412)
* support beta functionality * add testing, improve logic and code quality * improve testing and code quality * Fix warning message
This commit is contained in:
parent
890e38f22a
commit
a07ff3f9ba
4 changed files with 288 additions and 0 deletions
|
|
@ -34,6 +34,7 @@ type ProviderData struct {
|
|||
SecretsManagerCustomEndpoint string
|
||||
SQLServerFlexCustomEndpoint string
|
||||
SKECustomEndpoint string
|
||||
EnableBetaResources bool
|
||||
}
|
||||
|
||||
// DiagsToError Converts TF diagnostics' errors into an error with a human-readable description.
|
||||
|
|
@ -66,3 +67,17 @@ func LogAndAddWarning(ctx context.Context, diags *diag.Diagnostics, summary, det
|
|||
tflog.Warn(ctx, fmt.Sprintf("%s | %s", summary, detail))
|
||||
diags.AddWarning(summary, detail)
|
||||
}
|
||||
|
||||
func LogAndAddWarningBeta(ctx context.Context, diags *diag.Diagnostics, name string) {
|
||||
warnTitle := fmt.Sprintf("The resource %q is in BETA", name)
|
||||
warnContent := fmt.Sprintf("The resource %q is in BETA and may be subject to breaking changes in the future. Use with caution.", name)
|
||||
tflog.Warn(ctx, fmt.Sprintf("%s | %s", warnTitle, warnContent))
|
||||
diags.AddWarning(warnTitle, warnContent)
|
||||
}
|
||||
|
||||
func LogAndAddErrorBeta(ctx context.Context, diags *diag.Diagnostics, name string) {
|
||||
errTitle := fmt.Sprintf("The resource %q is in BETA and BETA is not enabled", name)
|
||||
errContent := fmt.Sprintf("The resource %q is in BETA and the BETA functionality is currently not enabled. Please refer to the documentation on how to enable the BETA functionality.", name)
|
||||
tflog.Error(ctx, fmt.Sprintf("%s | %s", errTitle, errContent))
|
||||
diags.AddError(errTitle, errContent)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue