diff --git a/mongodbatlas/resource_mongodbatlas_event_trigger_test.go b/mongodbatlas/resource_mongodbatlas_event_trigger_test.go index 92eea571ac..db5e07d4bb 100644 --- a/mongodbatlas/resource_mongodbatlas_event_trigger_test.go +++ b/mongodbatlas/resource_mongodbatlas_event_trigger_test.go @@ -10,6 +10,7 @@ import ( "github.com/hashicorp/terraform-plugin-testing/helper/acctest" "github.com/hashicorp/terraform-plugin-testing/helper/resource" "github.com/hashicorp/terraform-plugin-testing/terraform" + "github.com/mongodb/terraform-provider-mongodbatlas/mongodbatlas/util" "github.com/mwielbut/pointy" "go.mongodb.org/realm/realm" ) @@ -80,12 +81,12 @@ func TestAccConfigRSEventTriggerDatabase_basic(t *testing.T) { func TestAccConfigRSEventTriggerDatabase_eventProccesor(t *testing.T) { SkipTestForCI(t) var ( - resourceName = "mongodbatlas_event_trigger.test" - projectID = os.Getenv("MONGODB_ATLAS_PROJECT_ID") - awsAccountID = os.Getenv("AWS_ACCOUNT_ID") - awsRegion = os.Getenv("AWS_REGION") - appID = os.Getenv("MONGODB_REALM_APP_ID") - eventResp = realm.EventTrigger{} + resourceName = "mongodbatlas_event_trigger.test" + projectID = os.Getenv("MONGODB_ATLAS_PROJECT_ID") + eventBridgeAwsAccountID = os.Getenv("AWS_EVENTBRIDGE_ACCOUNT_ID") + eventBridgeAwsRegion = util.MongoDBRegionToAWSRegion(os.Getenv("AWS_REGION")) + appID = os.Getenv("MONGODB_REALM_APP_ID") + eventResp = realm.EventTrigger{} ) event := realm.EventTriggerRequest{ Name: acctest.RandomWithPrefix("test-acc"), @@ -120,14 +121,14 @@ func TestAccConfigRSEventTriggerDatabase_eventProccesor(t *testing.T) { CheckDestroy: testAccCheckMongoDBAtlasEventTriggerDestroy, Steps: []resource.TestStep{ { - Config: testAccMongoDBAtlasEventTriggerDatabaseConfigDatabaseEP(projectID, appID, `"INSERT", "UPDATE"`, awsAccountID, awsRegion, &event), + Config: testAccMongoDBAtlasEventTriggerDatabaseConfigDatabaseEP(projectID, appID, `"INSERT", "UPDATE"`, eventBridgeAwsAccountID, eventBridgeAwsRegion, &event), Check: resource.ComposeTestCheckFunc( testAccCheckMongoDBAtlasEventTriggerExists(resourceName, &eventResp), resource.TestCheckResourceAttr(resourceName, "project_id", projectID), ), }, { - Config: testAccMongoDBAtlasEventTriggerDatabaseConfigDatabaseEP(projectID, appID, `"INSERT", "UPDATE", "DELETE"`, awsAccountID, awsRegion, &eventUpdated), + Config: testAccMongoDBAtlasEventTriggerDatabaseConfigDatabaseEP(projectID, appID, `"INSERT", "UPDATE", "DELETE"`, eventBridgeAwsAccountID, eventBridgeAwsRegion, &eventUpdated), Check: resource.ComposeTestCheckFunc( testAccCheckMongoDBAtlasEventTriggerExists(resourceName, &eventResp), resource.TestCheckResourceAttr(resourceName, "project_id", projectID), @@ -205,12 +206,12 @@ func TestAccConfigRSEventTriggerAuth_basic(t *testing.T) { func TestAccConfigRSEventTriggerAuth_eventProcessor(t *testing.T) { SkipTestForCI(t) var ( - resourceName = "mongodbatlas_event_trigger.test" - projectID = os.Getenv("MONGODB_ATLAS_PROJECT_ID") - awsAccountID = os.Getenv("AWS_ACCOUNT_ID") - awsRegion = os.Getenv("AWS_REGION") - appID = os.Getenv("MONGODB_REALM_APP_ID") - eventResp = realm.EventTrigger{} + resourceName = "mongodbatlas_event_trigger.test" + projectID = os.Getenv("MONGODB_ATLAS_PROJECT_ID") + eventBridgeAwsAccountID = os.Getenv("AWS_EVENTBRIDGE_ACCOUNT_ID") + eventBridgeAwsRegion = util.MongoDBRegionToAWSRegion(os.Getenv("AWS_REGION")) + appID = os.Getenv("MONGODB_REALM_APP_ID") + eventResp = realm.EventTrigger{} ) event := realm.EventTriggerRequest{ Name: acctest.RandomWithPrefix("test-acc"), @@ -240,14 +241,14 @@ func TestAccConfigRSEventTriggerAuth_eventProcessor(t *testing.T) { CheckDestroy: testAccCheckMongoDBAtlasEventTriggerDestroy, Steps: []resource.TestStep{ { - Config: testAccMongoDBAtlasEventTriggerDatabaseConfigAuthenticationEP(projectID, appID, `"anon-user", "local-userpass"`, awsAccountID, awsRegion, &event), + Config: testAccMongoDBAtlasEventTriggerDatabaseConfigAuthenticationEP(projectID, appID, `"anon-user", "local-userpass"`, eventBridgeAwsAccountID, eventBridgeAwsRegion, &event), Check: resource.ComposeTestCheckFunc( testAccCheckMongoDBAtlasEventTriggerExists(resourceName, &eventResp), resource.TestCheckResourceAttr(resourceName, "project_id", projectID), ), }, { - Config: testAccMongoDBAtlasEventTriggerDatabaseConfigAuthenticationEP(projectID, appID, `"anon-user", "local-userpass", "api-key"`, awsAccountID, awsRegion, &eventUpdated), + Config: testAccMongoDBAtlasEventTriggerDatabaseConfigAuthenticationEP(projectID, appID, `"anon-user", "local-userpass", "api-key"`, eventBridgeAwsAccountID, eventBridgeAwsRegion, &eventUpdated), Check: resource.ComposeTestCheckFunc( testAccCheckMongoDBAtlasEventTriggerExists(resourceName, &eventResp), resource.TestCheckResourceAttr(resourceName, "project_id", projectID), @@ -322,12 +323,12 @@ func TestAccConfigRSEventTriggerSchedule_basic(t *testing.T) { func TestAccConfigRSEventTriggerSchedule_eventProcessor(t *testing.T) { SkipTestForCI(t) var ( - resourceName = "mongodbatlas_event_trigger.test" - projectID = os.Getenv("MONGODB_ATLAS_PROJECT_ID") - awsAccountID = os.Getenv("AWS_ACCOUNT_ID") - awsRegion = os.Getenv("AWS_REGION") - appID = os.Getenv("MONGODB_REALM_APP_ID") - eventResp = realm.EventTrigger{} + resourceName = "mongodbatlas_event_trigger.test" + projectID = os.Getenv("MONGODB_ATLAS_PROJECT_ID") + eventBridgeAwsAccountID = os.Getenv("AWS_EVENTBRIDGE_ACCOUNT_ID") + eventBridgeAwsRegion = util.MongoDBRegionToAWSRegion(os.Getenv("AWS_REGION")) + appID = os.Getenv("MONGODB_REALM_APP_ID") + eventResp = realm.EventTrigger{} ) event := realm.EventTriggerRequest{ Name: acctest.RandomWithPrefix("test-acc"), @@ -354,14 +355,14 @@ func TestAccConfigRSEventTriggerSchedule_eventProcessor(t *testing.T) { CheckDestroy: testAccCheckMongoDBAtlasEventTriggerDestroy, Steps: []resource.TestStep{ { - Config: testAccMongoDBAtlasEventTriggerDatabaseConfigScheduleEP(projectID, appID, awsAccountID, awsRegion, &event), + Config: testAccMongoDBAtlasEventTriggerDatabaseConfigScheduleEP(projectID, appID, eventBridgeAwsAccountID, eventBridgeAwsRegion, &event), Check: resource.ComposeTestCheckFunc( testAccCheckMongoDBAtlasEventTriggerExists(resourceName, &eventResp), resource.TestCheckResourceAttr(resourceName, "project_id", projectID), ), }, { - Config: testAccMongoDBAtlasEventTriggerDatabaseConfigScheduleEP(projectID, appID, awsAccountID, awsRegion, &eventUpdated), + Config: testAccMongoDBAtlasEventTriggerDatabaseConfigScheduleEP(projectID, appID, eventBridgeAwsAccountID, eventBridgeAwsRegion, &eventUpdated), Check: resource.ComposeTestCheckFunc( testAccCheckMongoDBAtlasEventTriggerExists(resourceName, &eventResp), resource.TestCheckResourceAttr(resourceName, "project_id", projectID),