Skip to content

Commit

Permalink
refactor: refactor some
Browse files Browse the repository at this point in the history
  • Loading branch information
Edgar López authored and coderGo93 committed Jun 29, 2021
1 parent 2966ccf commit 71d253a
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 36 deletions.
2 changes: 0 additions & 2 deletions mongodbatlas/data_source_mongodbatlas_event_trigger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ func TestAccDataSourceMongoDBAtlasEventTrigger_basic(t *testing.T) {
Disabled: pointy.Bool(false),
Config: &realm.EventTriggerConfig{
OperationTypes: []string{"INSERT", "UPDATE"},
OperationType: "LOGIN",
Providers: []string{"anon-user", "local-userpass"},
Database: "sample_airbnb",
Collection: "listingsAndReviews",
ServiceID: os.Getenv("MONGODB_REALM_SERVICE_ID"),
Expand Down
8 changes: 0 additions & 8 deletions mongodbatlas/resource_mongodbatlas_event_trigger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ func TestAccResourceMongoDBAtlasEventTriggerDatabase_basic(t *testing.T) {
Disabled: pointy.Bool(false),
Config: &realm.EventTriggerConfig{
OperationTypes: []string{"INSERT", "UPDATE"},
OperationType: "LOGIN",
Providers: []string{"anon-user", "local-userpass"},
Database: "sample_airbnb",
Collection: "listingsAndReviews",
ServiceID: os.Getenv("MONGODB_REALM_SERVICE_ID"),
Expand All @@ -44,8 +42,6 @@ func TestAccResourceMongoDBAtlasEventTriggerDatabase_basic(t *testing.T) {
Disabled: pointy.Bool(false),
Config: &realm.EventTriggerConfig{
OperationTypes: []string{"INSERT", "UPDATE", "DELETE"},
OperationType: "LOGIN",
Providers: []string{"anon-user", "local-userpass"},
Database: "sample_airbnb",
Collection: "listingsAndReviews",
ServiceID: os.Getenv("MONGODB_REALM_SERVICE_ID"),
Expand Down Expand Up @@ -99,8 +95,6 @@ func TestAccResourceMongoDBAtlasEventTriggerDatabase_eventProccesor(t *testing.T
Disabled: pointy.Bool(false),
Config: &realm.EventTriggerConfig{
OperationTypes: []string{"INSERT", "UPDATE"},
OperationType: "LOGIN",
Providers: []string{"anon-user", "local-userpass"},
Database: "sample_airbnb",
Collection: "listingsAndReviews",
ServiceID: os.Getenv("MONGODB_REALM_SERVICE_ID"),
Expand All @@ -114,8 +108,6 @@ func TestAccResourceMongoDBAtlasEventTriggerDatabase_eventProccesor(t *testing.T
Disabled: pointy.Bool(false),
Config: &realm.EventTriggerConfig{
OperationTypes: []string{"INSERT", "UPDATE", "DELETE"},
OperationType: "LOGIN",
Providers: []string{"anon-user", "local-userpass"},
Database: "sample_airbnb",
Collection: "listingsAndReviews",
ServiceID: os.Getenv("MONGODB_REALM_SERVICE_ID"),
Expand Down
11 changes: 1 addition & 10 deletions website/docs/d/event_trigger.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,11 @@ description: |-
resource "mongodbatlas_event_trigger" "test" {
project_id = "PROJECT ID"
app_id = "APPLICATION ID"
name = "NAME OF THE TRINGGER"
name = "NAME OF THE TRIGGER"
type = "DATABASE"
function_id = "1"
disabled = false
config_operation_types = ["INSERT", "UPDATE"]
config_operation_type = "LOGIN"
config_providers = "anon-user"
config_database = "DATABASE NAME"
config_collection = "COLLECTION NAME"
config_service_id = "1"
Expand All @@ -31,13 +29,6 @@ resource "mongodbatlas_event_trigger" "test" {
value = "EXPRESSION"
}
config_full_document = false
config_schedule = "*"
event_processors {
aws_eventbridge {
config_account_id = "AWS ACCOUNT ID"
config_region = "AWS REGIOn"
}
}
}
data "mongodbatlas_event_trigger" "test" {
Expand Down
18 changes: 18 additions & 0 deletions website/docs/d/event_triggers.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,24 @@ description: |-
## Example Usage

```hcl
resource "mongodbatlas_event_trigger" "test" {
project_id = "PROJECT ID"
app_id = "APPLICATION ID"
name = "NAME OF THE TRIGGER"
type = "DATABASE"
function_id = "1"
disabled = false
config_operation_types = ["INSERT", "UPDATE"]
config_database = "DATABASE NAME"
config_collection = "COLLECTION NAME"
config_service_id = "1"
config_match {
key = "KEY",
value = "EXPRESSION"
}
config_full_document = false
}
data "mongodbatlas_event_triggers" "test" {
project_id = mongodbatlas_event_trigger.test.project_id
app_id = mongodbatlas_event_trigger.test.app_id
Expand Down
32 changes: 16 additions & 16 deletions website/docs/r/event_trigger.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ description: |-

## Example Usages

### Example Usage: DATABASE with function
### Example Usage: Database Trigger with Function
```hcl
resource "mongodbatlas_event_trigger" "test" {
project_id = "PROJECT ID"
Expand Down Expand Up @@ -44,7 +44,7 @@ EOF
}
```

### Example Usage: DATABASE with eventbridge
### Example Usage: Database Trigger with EventBridge
```hcl
resource "mongodbatlas_event_trigger" "test" {
project_id = "PROJECT ID"
Expand Down Expand Up @@ -72,7 +72,7 @@ resource "mongodbatlas_event_trigger" "test" {
}
```

### Example Usage: AUTHENTICATION
### Example Usage: Authentication Trigger
```hcl
resource "mongodbatlas_event_trigger" "test" {
project_id = "PROJECT ID"
Expand All @@ -86,7 +86,7 @@ resource "mongodbatlas_event_trigger" "test" {
}
```

### Example Usage: SCHEDULED with eventbridge
### Example Usage: Scheduled Trigger
```hcl
resource "mongodbatlas_event_trigger" "test" {
project_id = "PROJECT ID"
Expand All @@ -104,19 +104,19 @@ resource "mongodbatlas_event_trigger" "test" {
* `project_id` - (Required) The unique ID for the project to create the trigger.
* `app_id` - (Required) The ObjectID of your application.
* `name` - (Required) The name of the trigger.
* `type` - (Required) The type of the trigger. Possible Values: `DATABASE`, `AUTHENTICATION`
* `type` - (Required) The type of the trigger. Possible Values: `DATABASE`, `AUTHENTICATION`,`SCHEDULED`
* `function_id` - (Optional) The ID of the function associated with the trigger.
* `disabled` - (Optional) Default: `false` If `true`, the trigger is disabled.
* `config_operation_types` - (Optional) The [database event operation types](https://docs.mongodb.com/realm/triggers/database-triggers/#std-label-database-events) to listen for. This must contain at least one value. Required for `DATABASE` type. Possible Values: `INSERT`, `UPDATE`, `REPLACE`, `DELETE`
* `config_operation_type` - (Optional) The [authentication operation type](https://docs.mongodb.com/realm/triggers/authentication-triggers/#std-label-authentication-event-operation-types) to listen for. Required for `AUTHENTICATION` type. Possible Values: `LOGIN`, `CREATE`, `DELETE`
* `config_providers` - (Optional) A list of one or more [authentication provider](https://docs.mongodb.com/realm/authentication/providers/) id values. The trigger will only listen for authentication events produced by these providers. Required for `AUTHENTICATION` type.
* `config_database` - (Optional) The name of the MongoDB database that contains the watched collection. Required for `DATABASE` type.
* `config_collection` - (Optional) The name of the MongoDB collection that the trigger watches for change events. The collection must be part of the specified database. Required for `DATABASE` type.
* `config_service_id` - (Optional) The ID of the MongoDB Service associated with the trigger. Required for `DATABASE` type.
* `config_match` - (Optional) A [$match](https://docs.mongodb.com/manual/reference/operator/aggregation/match/) expression document that MongoDB Realm includes in the underlying change stream pipeline for the trigger. This is useful when you want to filter change events beyond their operation type. The trigger will only fire if the expression evaluates to true for a given change event. Required for `DATABASE` type.
* `config_project` - (Optional) A [$project](https://docs.mongodb.com/manual/reference/operator/aggregation/project/) expression document that Realm uses to filter the fields that appear in change event objects. Required for `DATABASE` type.
* `config_full_document` - (Optional) If true, indicates that `UPDATE` change events should include the most current [majority-committed](https://docs.mongodb.com/manual/reference/read-concern-majority/) version of the modified document in the fullDocument field.
* `config_schedule` - (Optional) A [cron expression](https://docs.mongodb.com/realm/triggers/cron-expressions/) that defines the trigger schedule.
* `config_operation_types` - (Optional) Required for `DATABASE` type. The [database event operation types](https://docs.mongodb.com/realm/triggers/database-triggers/#std-label-database-events) to listen for. This must contain at least one value. Possible Values: `INSERT`, `UPDATE`, `REPLACE`, `DELETE`
* `config_operation_type` - (Optional) Required for `AUTHENTICATION` type. The [authentication operation type](https://docs.mongodb.com/realm/triggers/authentication-triggers/#std-label-authentication-event-operation-types) to listen for. Possible Values: `LOGIN`, `CREATE`, `DELETE`
* `config_providers` - (Optional) Required for `AUTHENTICATION` type. A list of one or more [authentication provider](https://docs.mongodb.com/realm/authentication/providers/) id values. The trigger will only listen for authentication events produced by these providers.
* `config_database` - (Optional) Required for `DATABASE` type. The name of the MongoDB database that contains the watched collection.
* `config_collection` - (Optional) Required for `DATABASE` type. The name of the MongoDB collection that the trigger watches for change events. The collection must be part of the specified database.
* `config_service_id` - (Optional) Required for `DATABASE` type. The ID of the MongoDB Service associated with the trigger.
* `config_match` - (Optional) Optional for `DATABASE` type. A [$match](https://docs.mongodb.com/manual/reference/operator/aggregation/match/) expression document that MongoDB Realm includes in the underlying change stream pipeline for the trigger. This is useful when you want to filter change events beyond their operation type. The trigger will only fire if the expression evaluates to true for a given change event.
* `config_project` - (Optional) Optional for `DATABASE` type. A [$project](https://docs.mongodb.com/manual/reference/operator/aggregation/project/) expression document that Realm uses to filter the fields that appear in change event objects.
* `config_full_document` - (Optional) Optional for `DATABASE` type. If true, indicates that `UPDATE` change events should include the most current [majority-committed](https://docs.mongodb.com/manual/reference/read-concern-majority/) version of the modified document in the fullDocument field.
* `config_schedule` - (Optional) Required for `SCHEDULED` type. A [cron expression](https://docs.mongodb.com/realm/triggers/cron-expressions/) that defines the trigger schedule.
* `event_processors` - (Optional) An object where each field name is an event processor ID and each value is an object that configures its corresponding event processor. The following event processors are supported: `AWS_EVENTBRIDGE` For an example configuration object, see [Send Trigger Events to AWS EventBridge](https://docs.mongodb.com/realm/triggers/eventbridge/#std-label-event_processor_example).
* `event_processors.0.aws_eventbridge.config_account_id` - (Optional) AWS Account ID.
* `event_processors.0.aws_eventbridge.config_region` - (Optional) Region of AWS Account.
Expand All @@ -125,7 +125,7 @@ resource "mongodbatlas_event_trigger" "test" {

In addition to all arguments above, the following attributes are exported:

* `id` - The Terraform's unique identifier used internally for state management.
* `id` - Terraform's unique identifier used internally for state management.
* `trigger_id` - The unique ID of the trigger.
* `function_name` - The name of the function associated with the trigger.

Expand Down

0 comments on commit 71d253a

Please sign in to comment.