@@ -486,12 +486,10 @@ func getDatabaseSchema(typ schema.ValueType) schemaMap {
486486			ConflictsWith : util .CalculateConflictsWith (dbEngineInfluxDB .Name (), dbEngineTypes ),
487487		},
488488		dbEngineMongoDB .name : {
489- 			Type :        typ ,
490- 			Optional :    true ,
491- 			Description : "Connection parameters for the mongodb-database-plugin plugin." ,
492- 			Elem : connectionStringResource (& connectionStringConfig {
493- 				includeUserPass : true ,
494- 			}),
489+ 			Type :          typ ,
490+ 			Optional :      true ,
491+ 			Description :   "Connection parameters for the mongodb-database-plugin plugin." ,
492+ 			Elem :          mongodbConnectionStringResource (),
495493			MaxItems :      1 ,
496494			ConflictsWith : util .CalculateConflictsWith (dbEngineMongoDB .Name (), dbEngineTypes ),
497495		},
@@ -942,6 +940,23 @@ func snowflakeConnectionStringResource() *schema.Resource {
942940
943941	r .Schema [consts .FieldPassword ].Deprecated  =  "Snowflake is ending support for single-factor password authentication "  + 
944942		"by November 2025. Refer to the documentation for more information on migrating to key-pair authentication." 
943+ 	return  r 
944+ }
945+ 
946+ func  mongodbConnectionStringResource () * schema.Resource  {
947+ 	r  :=  connectionStringResource (& connectionStringConfig {
948+ 		includeUserPass : true ,
949+ 	})
950+ 	r .Schema ["tls_certificate_key" ] =  & schema.Schema {
951+ 		Type :        schema .TypeString ,
952+ 		Optional :    true ,
953+ 		Description : "x509 certificate for connecting to the database. This must be a PEM encoded version of the private key and the certificate combined." ,
954+ 	}
955+ 	r .Schema ["tls_ca" ] =  & schema.Schema {
956+ 		Type :        schema .TypeString ,
957+ 		Optional :    true ,
958+ 		Description : "x509 CA file for validating the certificate presented by the MongoDB server. Must be PEM encoded." ,
959+ 	}
945960
946961	return  r 
947962}
@@ -1017,7 +1032,7 @@ func getDatabaseAPIDataForEngine(engine *dbEngine, idx int, d *schema.ResourceDa
10171032	case  dbEngineHana :
10181033		setDatabaseConnectionDataWithDisableEscaping (d , prefix , data )
10191034	case  dbEngineMongoDB :
1020- 		setDatabaseConnectionDataWithUserPass (d , prefix , data )
1035+ 		setMongoDBDatabaseConnectionData (d , prefix , data )
10211036	case  dbEngineMongoDBAtlas :
10221037		setMongoDBAtlasDatabaseConnectionData (d , prefix , data )
10231038	case  dbEngineMSSQL :
@@ -1281,6 +1296,31 @@ func getMySQLConnectionDetailsFromResponse(d *schema.ResourceData, prefix string
12811296	return  result 
12821297}
12831298
1299+ func  getMongoDBConnectionDetailsFromResponse (d  * schema.ResourceData , prefix  string , resp  * api.Secret ) map [string ]interface {} {
1300+ 	result  :=  getConnectionDetailsFromResponseWithUserPass (d , prefix , resp )
1301+ 	details  :=  resp .Data ["connection_details" ]
1302+ 	data , ok  :=  details .(map [string ]interface {})
1303+ 	if  ! ok  {
1304+ 		return  nil 
1305+ 	}
1306+ 	if  v , ok  :=  d .GetOk (prefix  +  "tls_certificate_key" ); ok  {
1307+ 		result ["tls_certificate_key" ] =  v .(string )
1308+ 	} else  {
1309+ 		if  v , ok  :=  data ["tls_certificate_key" ]; ok  {
1310+ 			result ["tls_certificate_key" ] =  v .(string )
1311+ 		}
1312+ 	}
1313+ 	if  v , ok  :=  d .GetOk (prefix  +  "tls_ca" ); ok  {
1314+ 		result ["tls_ca" ] =  v .(string )
1315+ 	} else  {
1316+ 		if  v , ok  :=  data ["tls_ca" ]; ok  {
1317+ 			result ["tls_ca" ] =  v .(string )
1318+ 		}
1319+ 	}
1320+ 
1321+ 	return  result 
1322+ }
1323+ 
12841324func  getRedisConnectionDetailsFromResponse (d  * schema.ResourceData , prefix  string , resp  * api.Secret ) map [string ]interface {} {
12851325	details  :=  resp .Data ["connection_details" ]
12861326	data , ok  :=  details .(map [string ]interface {})
@@ -1624,6 +1664,16 @@ func setMySQLDatabaseConnectionData(d *schema.ResourceData, prefix string, data
16241664	}
16251665}
16261666
1667+ func  setMongoDBDatabaseConnectionData (d  * schema.ResourceData , prefix  string , data  map [string ]interface {}) {
1668+ 	setDatabaseConnectionDataWithUserPass (d , prefix , data )
1669+ 	if  v , ok  :=  d .GetOk (prefix  +  "tls_certificate_key" ); ok  {
1670+ 		data ["tls_certificate_key" ] =  v .(string )
1671+ 	}
1672+ 	if  v , ok  :=  d .GetOk (prefix  +  "tls_ca" ); ok  {
1673+ 		data ["tls_ca" ] =  v .(string )
1674+ 	}
1675+ }
1676+ 
16271677func  setPostgresDatabaseConnectionData (d  * schema.ResourceData , prefix  string , data  map [string ]interface {}, meta  interface {}) {
16281678	setDatabaseConnectionDataWithDisableEscaping (d , prefix , data )
16291679	setCloudDatabaseConnectionData (d , prefix , data , meta )
@@ -2140,7 +2190,7 @@ func getDBConnectionConfig(d *schema.ResourceData, engine *dbEngine, idx int,
21402190	case  dbEngineHana :
21412191		result  =  getConnectionDetailsFromResponseWithDisableEscaping (d , prefix , resp )
21422192	case  dbEngineMongoDB :
2143- 		result  =  getConnectionDetailsFromResponseWithUserPass (d , prefix , resp )
2193+ 		result  =  getMongoDBConnectionDetailsFromResponse (d , prefix , resp )
21442194	case  dbEngineMongoDBAtlas :
21452195		result  =  getConnectionDetailsMongoDBAtlas (d , prefix , resp )
21462196	case  dbEngineMSSQL :
0 commit comments