@@ -10,6 +10,7 @@ import (
10
10
"github.com/hashicorp/terraform-plugin-testing/helper/acctest"
11
11
"github.com/hashicorp/terraform-plugin-testing/helper/resource"
12
12
"github.com/hashicorp/terraform-plugin-testing/terraform"
13
+ "github.com/mongodb/terraform-provider-mongodbatlas/mongodbatlas/util"
13
14
"github.com/mwielbut/pointy"
14
15
"go.mongodb.org/realm/realm"
15
16
)
@@ -80,12 +81,12 @@ func TestAccConfigRSEventTriggerDatabase_basic(t *testing.T) {
80
81
func TestAccConfigRSEventTriggerDatabase_eventProccesor (t * testing.T ) {
81
82
SkipTestForCI (t )
82
83
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 {}
89
90
)
90
91
event := realm.EventTriggerRequest {
91
92
Name : acctest .RandomWithPrefix ("test-acc" ),
@@ -120,14 +121,14 @@ func TestAccConfigRSEventTriggerDatabase_eventProccesor(t *testing.T) {
120
121
CheckDestroy : testAccCheckMongoDBAtlasEventTriggerDestroy ,
121
122
Steps : []resource.TestStep {
122
123
{
123
- Config : testAccMongoDBAtlasEventTriggerDatabaseConfigDatabaseEP (projectID , appID , `"INSERT", "UPDATE"` , awsAccountID , awsRegion , & event ),
124
+ Config : testAccMongoDBAtlasEventTriggerDatabaseConfigDatabaseEP (projectID , appID , `"INSERT", "UPDATE"` , eventBridgeAwsAccountID , eventBridgeAwsRegion , & event ),
124
125
Check : resource .ComposeTestCheckFunc (
125
126
testAccCheckMongoDBAtlasEventTriggerExists (resourceName , & eventResp ),
126
127
resource .TestCheckResourceAttr (resourceName , "project_id" , projectID ),
127
128
),
128
129
},
129
130
{
130
- Config : testAccMongoDBAtlasEventTriggerDatabaseConfigDatabaseEP (projectID , appID , `"INSERT", "UPDATE", "DELETE"` , awsAccountID , awsRegion , & eventUpdated ),
131
+ Config : testAccMongoDBAtlasEventTriggerDatabaseConfigDatabaseEP (projectID , appID , `"INSERT", "UPDATE", "DELETE"` , eventBridgeAwsAccountID , eventBridgeAwsRegion , & eventUpdated ),
131
132
Check : resource .ComposeTestCheckFunc (
132
133
testAccCheckMongoDBAtlasEventTriggerExists (resourceName , & eventResp ),
133
134
resource .TestCheckResourceAttr (resourceName , "project_id" , projectID ),
@@ -205,12 +206,12 @@ func TestAccConfigRSEventTriggerAuth_basic(t *testing.T) {
205
206
func TestAccConfigRSEventTriggerAuth_eventProcessor (t * testing.T ) {
206
207
SkipTestForCI (t )
207
208
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 {}
214
215
)
215
216
event := realm.EventTriggerRequest {
216
217
Name : acctest .RandomWithPrefix ("test-acc" ),
@@ -240,14 +241,14 @@ func TestAccConfigRSEventTriggerAuth_eventProcessor(t *testing.T) {
240
241
CheckDestroy : testAccCheckMongoDBAtlasEventTriggerDestroy ,
241
242
Steps : []resource.TestStep {
242
243
{
243
- Config : testAccMongoDBAtlasEventTriggerDatabaseConfigAuthenticationEP (projectID , appID , `"anon-user", "local-userpass"` , awsAccountID , awsRegion , & event ),
244
+ Config : testAccMongoDBAtlasEventTriggerDatabaseConfigAuthenticationEP (projectID , appID , `"anon-user", "local-userpass"` , eventBridgeAwsAccountID , eventBridgeAwsRegion , & event ),
244
245
Check : resource .ComposeTestCheckFunc (
245
246
testAccCheckMongoDBAtlasEventTriggerExists (resourceName , & eventResp ),
246
247
resource .TestCheckResourceAttr (resourceName , "project_id" , projectID ),
247
248
),
248
249
},
249
250
{
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 ),
251
252
Check : resource .ComposeTestCheckFunc (
252
253
testAccCheckMongoDBAtlasEventTriggerExists (resourceName , & eventResp ),
253
254
resource .TestCheckResourceAttr (resourceName , "project_id" , projectID ),
@@ -322,12 +323,12 @@ func TestAccConfigRSEventTriggerSchedule_basic(t *testing.T) {
322
323
func TestAccConfigRSEventTriggerSchedule_eventProcessor (t * testing.T ) {
323
324
SkipTestForCI (t )
324
325
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 {}
331
332
)
332
333
event := realm.EventTriggerRequest {
333
334
Name : acctest .RandomWithPrefix ("test-acc" ),
@@ -354,14 +355,14 @@ func TestAccConfigRSEventTriggerSchedule_eventProcessor(t *testing.T) {
354
355
CheckDestroy : testAccCheckMongoDBAtlasEventTriggerDestroy ,
355
356
Steps : []resource.TestStep {
356
357
{
357
- Config : testAccMongoDBAtlasEventTriggerDatabaseConfigScheduleEP (projectID , appID , awsAccountID , awsRegion , & event ),
358
+ Config : testAccMongoDBAtlasEventTriggerDatabaseConfigScheduleEP (projectID , appID , eventBridgeAwsAccountID , eventBridgeAwsRegion , & event ),
358
359
Check : resource .ComposeTestCheckFunc (
359
360
testAccCheckMongoDBAtlasEventTriggerExists (resourceName , & eventResp ),
360
361
resource .TestCheckResourceAttr (resourceName , "project_id" , projectID ),
361
362
),
362
363
},
363
364
{
364
- Config : testAccMongoDBAtlasEventTriggerDatabaseConfigScheduleEP (projectID , appID , awsAccountID , awsRegion , & eventUpdated ),
365
+ Config : testAccMongoDBAtlasEventTriggerDatabaseConfigScheduleEP (projectID , appID , eventBridgeAwsAccountID , eventBridgeAwsRegion , & eventUpdated ),
365
366
Check : resource .ComposeTestCheckFunc (
366
367
testAccCheckMongoDBAtlasEventTriggerExists (resourceName , & eventResp ),
367
368
resource .TestCheckResourceAttr (resourceName , "project_id" , projectID ),
0 commit comments