Skip to content

Commit

Permalink
fix region default value.
Browse files Browse the repository at this point in the history
  • Loading branch information
marcosuma committed Oct 16, 2023
1 parent 07321cb commit 57336e7
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions mongodbatlas/fw_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"log"
"regexp"
"strings"
"time"

"github.com/hashicorp/terraform-plugin-framework-validators/listvalidator"
Expand Down Expand Up @@ -359,10 +360,12 @@ func setDefaultValuesWithValidations(ctx context.Context, data *tfMongodbAtlasPr
}

if data.Region.ValueString() == "" {
data.Region = types.StringValue(MultiEnvDefaultFunc([]string{
// Convert the input string to lowercase and replace all underscores with hyphens.
region := strings.ReplaceAll(strings.ToLower(MultiEnvDefaultFunc([]string{
"AWS_REGION",
"TF_VAR_AWS_REGION",
}, "").(string))
}, "").(string)), "_", "-")
data.Region = types.StringValue(region)
}

if data.StsEndpoint.ValueString() == "" {
Expand Down

0 comments on commit 57336e7

Please sign in to comment.