chore(terraform): refactor region overrides in mapping funcs (#872)
This commit is contained in:
parent
0272a86292
commit
5e5404b459
31 changed files with 185 additions and 194 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue