@@ -34,14 +34,15 @@ import (
34
34
"github.com/mongodb/terraform-provider-mongodbatlas/internal/service/searchdeployment"
35
35
"github.com/mongodb/terraform-provider-mongodbatlas/internal/service/streamconnection"
36
36
"github.com/mongodb/terraform-provider-mongodbatlas/internal/service/streaminstance"
37
-
38
37
"github.com/mongodb/terraform-provider-mongodbatlas/version"
39
38
)
40
39
41
40
const (
42
- MongodbGovCloudURL = "https://cloud.mongodbgov.com"
43
- ProviderConfigError = "error in configuring the provider."
44
- MissingAuthAttrError = "either Atlas Programmatic API Keys or AWS Secrets Manager attributes must be set"
41
+ MongodbGovCloudURL = "https://cloud.mongodbgov.com"
42
+ MongodbGovCloudQAURL = "https://cloud-qa.mongodbgov.com"
43
+ MongodbGovCloudDevURL = "https://cloud-dev.mongodbgov.com"
44
+ ProviderConfigError = "error in configuring the provider."
45
+ MissingAuthAttrError = "either Atlas Programmatic API Keys or AWS Secrets Manager attributes must be set"
45
46
)
46
47
47
48
type MongodbtlasProvider struct {}
@@ -296,7 +297,9 @@ func parseTfModel(ctx context.Context, tfAssumeRoleModel *tfAssumeRoleModel) *co
296
297
297
298
func setDefaultValuesWithValidations (ctx context.Context , data * tfMongodbAtlasProviderModel , resp * provider.ConfigureResponse ) tfMongodbAtlasProviderModel {
298
299
if mongodbgovCloud := data .IsMongodbGovCloud .ValueBool (); mongodbgovCloud {
299
- data .BaseURL = types .StringValue (MongodbGovCloudURL )
300
+ if ! isGovBaseURLConfiguredForProvider (data ) {
301
+ data .BaseURL = types .StringValue (MongodbGovCloudURL )
302
+ }
300
303
}
301
304
if data .BaseURL .ValueString () == "" {
302
305
data .BaseURL = types .StringValue (MultiEnvDefaultFunc ([]string {
@@ -475,3 +478,17 @@ func MultiEnvDefaultFunc(ks []string, def any) any {
475
478
}
476
479
return def
477
480
}
481
+
482
+ func isGovBaseURLConfigured (baseURL string ) bool {
483
+ if baseURL == "" {
484
+ baseURL = MultiEnvDefaultFunc ([]string {
485
+ "MONGODB_ATLAS_BASE_URL" ,
486
+ "MCLI_OPS_MANAGER_URL" ,
487
+ }, "" ).(string )
488
+ }
489
+ return baseURL == MongodbGovCloudDevURL || baseURL == MongodbGovCloudQAURL
490
+ }
491
+
492
+ func isGovBaseURLConfiguredForProvider (data * tfMongodbAtlasProviderModel ) bool {
493
+ return isGovBaseURLConfigured (data .BaseURL .ValueString ())
494
+ }
0 commit comments