Skip to content

Commit f41aa23

Browse files
authored
fix: adds missing DatabaseRegex field when creating FederatedDataSource (#1486)
* fix: adds missing DatabaseRegex field being populated when creating a new DataSource. * adds test coverage.
1 parent a9cfd52 commit f41aa23

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

mongodbatlas/resource_mongodbatlas_federated_database_instance.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -661,6 +661,7 @@ func newDataFederationDataSource(collectionFromConf map[string]interface{}) []ad
661661
Database: stringPtr(dataSourceFromConfMap["database"].(string)),
662662
Collection: stringPtr(dataSourceFromConfMap["collection"].(string)),
663663
CollectionRegex: stringPtr(dataSourceFromConfMap["collection_regex"].(string)),
664+
DatabaseRegex: stringPtr(dataSourceFromConfMap["database_regex"].(string)),
664665
DefaultFormat: stringPtr(dataSourceFromConfMap["default_format"].(string)),
665666
Path: stringPtr(dataSourceFromConfMap["path"].(string)),
666667
ProvenanceFieldName: stringPtr(dataSourceFromConfMap["provenance_field_name"].(string)),

mongodbatlas/resource_mongodbatlas_federated_database_instance_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ func TestAccFederatedDatabaseInstance_basic(t *testing.T) {
3232
resource.TestCheckResourceAttrSet(resourceName, "storage_stores.0.read_preference.0.tag_sets.#"),
3333
resource.TestCheckResourceAttr(resourceName, "storage_stores.0.read_preference.0.tag_sets.#", "2"),
3434
resource.TestCheckResourceAttr(resourceName, "storage_stores.0.read_preference.0.tag_sets.0.tags.#", "2"),
35+
resource.TestCheckResourceAttr(resourceName, "storage_databases.0.collections.0.data_sources.0.database", "sample_airbnb"),
3536
),
3637
},
3738
{
@@ -43,6 +44,7 @@ func TestAccFederatedDatabaseInstance_basic(t *testing.T) {
4344
resource.TestCheckResourceAttrSet(resourceName, "storage_stores.0.read_preference.0.tag_sets.#"),
4445
resource.TestCheckResourceAttr(resourceName, "storage_stores.0.read_preference.0.tag_sets.#", "1"),
4546
resource.TestCheckResourceAttr(resourceName, "storage_stores.0.read_preference.0.tag_sets.0.tags.#", "1"),
47+
resource.TestCheckResourceAttr(resourceName, "storage_databases.0.collections.0.data_sources.0.database_regex", ".sample_airbnb"),
4648
),
4749
},
4850
{
@@ -514,7 +516,7 @@ resource "mongodbatlas_federated_database_instance" "test" {
514516
name = "VirtualCollection0"
515517
data_sources {
516518
collection = "listingsAndReviews"
517-
database = "sample_airbnb"
519+
database_regex = ".sample_airbnb"
518520
store_name = "ClusterTest"
519521
}
520522
}

0 commit comments

Comments
 (0)