Skip to content

Commit 7ba7282

Browse files
authored
feat: fixes region and aws account to be used for trigger acc test (#1558)
* fixes region and aws account to be used for eventbridge trigger creation. * addresses comments. * addresses comments. * addresses comments. * removes skip test rule. * Revert "removes skip test rule." This reverts commit 5670d0a.
1 parent 6df6ad6 commit 7ba7282

File tree

1 file changed

+25
-24
lines changed

1 file changed

+25
-24
lines changed

mongodbatlas/resource_mongodbatlas_event_trigger_test.go

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
"github.com/hashicorp/terraform-plugin-testing/helper/acctest"
1111
"github.com/hashicorp/terraform-plugin-testing/helper/resource"
1212
"github.com/hashicorp/terraform-plugin-testing/terraform"
13+
"github.com/mongodb/terraform-provider-mongodbatlas/mongodbatlas/util"
1314
"github.com/mwielbut/pointy"
1415
"go.mongodb.org/realm/realm"
1516
)
@@ -80,12 +81,12 @@ func TestAccConfigRSEventTriggerDatabase_basic(t *testing.T) {
8081
func TestAccConfigRSEventTriggerDatabase_eventProccesor(t *testing.T) {
8182
SkipTestForCI(t)
8283
var (
83-
resourceName = "mongodbatlas_event_trigger.test"
84-
projectID = os.Getenv("MONGODB_ATLAS_PROJECT_ID")
85-
awsAccountID = os.Getenv("AWS_ACCOUNT_ID")
86-
awsRegion = os.Getenv("AWS_REGION")
87-
appID = os.Getenv("MONGODB_REALM_APP_ID")
88-
eventResp = realm.EventTrigger{}
84+
resourceName = "mongodbatlas_event_trigger.test"
85+
projectID = os.Getenv("MONGODB_ATLAS_PROJECT_ID")
86+
eventBridgeAwsAccountID = os.Getenv("AWS_EVENTBRIDGE_ACCOUNT_ID")
87+
eventBridgeAwsRegion = util.MongoDBRegionToAWSRegion(os.Getenv("AWS_REGION"))
88+
appID = os.Getenv("MONGODB_REALM_APP_ID")
89+
eventResp = realm.EventTrigger{}
8990
)
9091
event := realm.EventTriggerRequest{
9192
Name: acctest.RandomWithPrefix("test-acc"),
@@ -120,14 +121,14 @@ func TestAccConfigRSEventTriggerDatabase_eventProccesor(t *testing.T) {
120121
CheckDestroy: testAccCheckMongoDBAtlasEventTriggerDestroy,
121122
Steps: []resource.TestStep{
122123
{
123-
Config: testAccMongoDBAtlasEventTriggerDatabaseConfigDatabaseEP(projectID, appID, `"INSERT", "UPDATE"`, awsAccountID, awsRegion, &event),
124+
Config: testAccMongoDBAtlasEventTriggerDatabaseConfigDatabaseEP(projectID, appID, `"INSERT", "UPDATE"`, eventBridgeAwsAccountID, eventBridgeAwsRegion, &event),
124125
Check: resource.ComposeTestCheckFunc(
125126
testAccCheckMongoDBAtlasEventTriggerExists(resourceName, &eventResp),
126127
resource.TestCheckResourceAttr(resourceName, "project_id", projectID),
127128
),
128129
},
129130
{
130-
Config: testAccMongoDBAtlasEventTriggerDatabaseConfigDatabaseEP(projectID, appID, `"INSERT", "UPDATE", "DELETE"`, awsAccountID, awsRegion, &eventUpdated),
131+
Config: testAccMongoDBAtlasEventTriggerDatabaseConfigDatabaseEP(projectID, appID, `"INSERT", "UPDATE", "DELETE"`, eventBridgeAwsAccountID, eventBridgeAwsRegion, &eventUpdated),
131132
Check: resource.ComposeTestCheckFunc(
132133
testAccCheckMongoDBAtlasEventTriggerExists(resourceName, &eventResp),
133134
resource.TestCheckResourceAttr(resourceName, "project_id", projectID),
@@ -205,12 +206,12 @@ func TestAccConfigRSEventTriggerAuth_basic(t *testing.T) {
205206
func TestAccConfigRSEventTriggerAuth_eventProcessor(t *testing.T) {
206207
SkipTestForCI(t)
207208
var (
208-
resourceName = "mongodbatlas_event_trigger.test"
209-
projectID = os.Getenv("MONGODB_ATLAS_PROJECT_ID")
210-
awsAccountID = os.Getenv("AWS_ACCOUNT_ID")
211-
awsRegion = os.Getenv("AWS_REGION")
212-
appID = os.Getenv("MONGODB_REALM_APP_ID")
213-
eventResp = realm.EventTrigger{}
209+
resourceName = "mongodbatlas_event_trigger.test"
210+
projectID = os.Getenv("MONGODB_ATLAS_PROJECT_ID")
211+
eventBridgeAwsAccountID = os.Getenv("AWS_EVENTBRIDGE_ACCOUNT_ID")
212+
eventBridgeAwsRegion = util.MongoDBRegionToAWSRegion(os.Getenv("AWS_REGION"))
213+
appID = os.Getenv("MONGODB_REALM_APP_ID")
214+
eventResp = realm.EventTrigger{}
214215
)
215216
event := realm.EventTriggerRequest{
216217
Name: acctest.RandomWithPrefix("test-acc"),
@@ -240,14 +241,14 @@ func TestAccConfigRSEventTriggerAuth_eventProcessor(t *testing.T) {
240241
CheckDestroy: testAccCheckMongoDBAtlasEventTriggerDestroy,
241242
Steps: []resource.TestStep{
242243
{
243-
Config: testAccMongoDBAtlasEventTriggerDatabaseConfigAuthenticationEP(projectID, appID, `"anon-user", "local-userpass"`, awsAccountID, awsRegion, &event),
244+
Config: testAccMongoDBAtlasEventTriggerDatabaseConfigAuthenticationEP(projectID, appID, `"anon-user", "local-userpass"`, eventBridgeAwsAccountID, eventBridgeAwsRegion, &event),
244245
Check: resource.ComposeTestCheckFunc(
245246
testAccCheckMongoDBAtlasEventTriggerExists(resourceName, &eventResp),
246247
resource.TestCheckResourceAttr(resourceName, "project_id", projectID),
247248
),
248249
},
249250
{
250-
Config: testAccMongoDBAtlasEventTriggerDatabaseConfigAuthenticationEP(projectID, appID, `"anon-user", "local-userpass", "api-key"`, awsAccountID, awsRegion, &eventUpdated),
251+
Config: testAccMongoDBAtlasEventTriggerDatabaseConfigAuthenticationEP(projectID, appID, `"anon-user", "local-userpass", "api-key"`, eventBridgeAwsAccountID, eventBridgeAwsRegion, &eventUpdated),
251252
Check: resource.ComposeTestCheckFunc(
252253
testAccCheckMongoDBAtlasEventTriggerExists(resourceName, &eventResp),
253254
resource.TestCheckResourceAttr(resourceName, "project_id", projectID),
@@ -322,12 +323,12 @@ func TestAccConfigRSEventTriggerSchedule_basic(t *testing.T) {
322323
func TestAccConfigRSEventTriggerSchedule_eventProcessor(t *testing.T) {
323324
SkipTestForCI(t)
324325
var (
325-
resourceName = "mongodbatlas_event_trigger.test"
326-
projectID = os.Getenv("MONGODB_ATLAS_PROJECT_ID")
327-
awsAccountID = os.Getenv("AWS_ACCOUNT_ID")
328-
awsRegion = os.Getenv("AWS_REGION")
329-
appID = os.Getenv("MONGODB_REALM_APP_ID")
330-
eventResp = realm.EventTrigger{}
326+
resourceName = "mongodbatlas_event_trigger.test"
327+
projectID = os.Getenv("MONGODB_ATLAS_PROJECT_ID")
328+
eventBridgeAwsAccountID = os.Getenv("AWS_EVENTBRIDGE_ACCOUNT_ID")
329+
eventBridgeAwsRegion = util.MongoDBRegionToAWSRegion(os.Getenv("AWS_REGION"))
330+
appID = os.Getenv("MONGODB_REALM_APP_ID")
331+
eventResp = realm.EventTrigger{}
331332
)
332333
event := realm.EventTriggerRequest{
333334
Name: acctest.RandomWithPrefix("test-acc"),
@@ -354,14 +355,14 @@ func TestAccConfigRSEventTriggerSchedule_eventProcessor(t *testing.T) {
354355
CheckDestroy: testAccCheckMongoDBAtlasEventTriggerDestroy,
355356
Steps: []resource.TestStep{
356357
{
357-
Config: testAccMongoDBAtlasEventTriggerDatabaseConfigScheduleEP(projectID, appID, awsAccountID, awsRegion, &event),
358+
Config: testAccMongoDBAtlasEventTriggerDatabaseConfigScheduleEP(projectID, appID, eventBridgeAwsAccountID, eventBridgeAwsRegion, &event),
358359
Check: resource.ComposeTestCheckFunc(
359360
testAccCheckMongoDBAtlasEventTriggerExists(resourceName, &eventResp),
360361
resource.TestCheckResourceAttr(resourceName, "project_id", projectID),
361362
),
362363
},
363364
{
364-
Config: testAccMongoDBAtlasEventTriggerDatabaseConfigScheduleEP(projectID, appID, awsAccountID, awsRegion, &eventUpdated),
365+
Config: testAccMongoDBAtlasEventTriggerDatabaseConfigScheduleEP(projectID, appID, eventBridgeAwsAccountID, eventBridgeAwsRegion, &eventUpdated),
365366
Check: resource.ComposeTestCheckFunc(
366367
testAccCheckMongoDBAtlasEventTriggerExists(resourceName, &eventResp),
367368
resource.TestCheckResourceAttr(resourceName, "project_id", projectID),

0 commit comments

Comments
 (0)