Skip to content

Commit b0b7302

Browse files
AgustinBettatiAlexkuvaoarbusi
authored
fix: Enables creation of database event trigger with watch against database and not collection (#1968)
* feat: permit database watch against creation In order to accept database watch against creation, config_collection should be empty string (config_collection = "") * Update internal/service/eventtrigger/resource_event_trigger.go Co-authored-by: Oriol <[email protected]> * adjust documentation of resource and data sources * include acceptance test for database trigger over a database with no specific collection * use acc.RandomName * docs: remove redudant required/optional when is it specific to a type * doc: phrasing adjustment for config_database --------- Co-authored-by: Alex <[email protected]> Co-authored-by: Oriol <[email protected]>
1 parent a54f867 commit b0b7302

7 files changed

+142
-89
lines changed

internal/service/eventtrigger/data_source_event_trigger_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,12 @@ func TestAccEventTriggerDS_basic(t *testing.T) {
3838
resource.Test(t, resource.TestCase{
3939
PreCheck: func() { acc.PreCheck(t) },
4040
ProtoV6ProviderFactories: acc.TestAccProviderV6Factories,
41-
CheckDestroy: testAccCheckMongoDBAtlasEventTriggerDestroy,
41+
CheckDestroy: checkDestroy,
4242
Steps: []resource.TestStep{
4343
{
4444
Config: testAccMongoDBAtlasDataSourceEventTriggerConfig(projectID, appID, `"INSERT", "UPDATE"`, &event),
4545
Check: resource.ComposeTestCheckFunc(
46-
testAccCheckMongoDBAtlasEventTriggerExists(resourceName, &eventResp),
46+
checkExists(resourceName, &eventResp),
4747
),
4848
},
4949
},

internal/service/eventtrigger/data_source_event_triggers_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ func TestAccEventTriggerDSPlural_basic(t *testing.T) {
4444
{
4545
Config: testAccMongoDBAtlasEventTriggersDataSourceConfig(projectID, appID, `"INSERT", "UPDATE"`, &event),
4646
Check: resource.ComposeTestCheckFunc(
47-
testAccCheckMongoDBAtlasEventTriggerExists(resourceName, &eventResp),
47+
checkExists(resourceName, &eventResp),
4848
),
4949
},
5050
},

internal/service/eventtrigger/resource_event_trigger.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -240,8 +240,8 @@ func resourceMongoDBAtlasEventTriggersCreate(ctx context.Context, d *schema.Reso
240240
sche, oksch := d.GetOk("config_schedule")
241241

242242
if typeTrigger == "DATABASE" {
243-
if !okCots || !okD || !okC || !okSI {
244-
return diag.FromErr(fmt.Errorf("`config_operation_types`, `config_database`,`config_collection`,`config_service_id` must be provided if type is DATABASE"))
243+
if !okCots || !okD || !okSI {
244+
return diag.FromErr(fmt.Errorf("`config_operation_types`, `config_database`,`config_service_id` must be provided if type is DATABASE"))
245245
}
246246
}
247247
if typeTrigger == "AUTHENTICATION" {

0 commit comments

Comments
 (0)