chore(terraform): refactor region overrides in mapping funcs (#872)

This commit is contained in:
Ruben Hönle 2025-06-06 16:17:02 +02:00 committed by GitHub
parent 0272a86292
commit 5e5404b459
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
31 changed files with 185 additions and 194 deletions

View file

@ -6,6 +6,8 @@ import (
"net/http"
"strings"
"github.com/hashicorp/terraform-plugin-framework/types"
"github.com/hashicorp/terraform-plugin-framework/diag"
"github.com/hashicorp/terraform-plugin-log/tflog"
)
@ -61,6 +63,13 @@ func (pd *ProviderData) GetRegion() string {
return "eu01"
}
func (pd *ProviderData) GetRegionWithOverride(overrideRegion types.String) string {
if overrideRegion.IsUnknown() || overrideRegion.IsNull() {
return pd.GetRegion()
}
return overrideRegion.ValueString()
}
// DiagsToError Converts TF diagnostics' errors into an error with a human-readable description.
// If there are no errors, the output is nil
func DiagsToError(diags diag.Diagnostics) error {