Skip to content

Commit

Permalink
[INF-5307] - Add the MongoDB Ably Ingress Rule
Browse files Browse the repository at this point in the history
This adds the new Ably Ingress rule for MongoDB.
  • Loading branch information
graham-russell committed Dec 17, 2024
1 parent 0215957 commit 84cda97
Show file tree
Hide file tree
Showing 15 changed files with 598 additions and 11 deletions.
44 changes: 44 additions & 0 deletions docs/resources/ingress_rule_mongodb.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "ably_ingress_rule_mongodb Resource - terraform-provider-ably"
subcategory: ""
description: |-
The ably_ingress_rule_mongodb resource sets up a MongoDB Integration Rule to stream document changes from a database collection over Ably.
---

# ably_ingress_rule_mongodb (Resource)

The `ably_ingress_rule_mongodb` resource sets up a MongoDB Integration Rule to stream document changes from a database collection over Ably.



<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `app_id` (String) The Ably application ID.
- `target` (Attributes) object (rule_source) (see [below for nested schema](#nestedatt--target))

### Optional

- `status` (String) The status of the rule. Rules can be enabled or disabled.

### Read-Only

- `id` (String) The rule ID.

<a id="nestedatt--target"></a>
### Nested Schema for `target`

Required:

- `collection` (String) What the connector should watch within the database. The connector only supports watching collections.
- `database` (String) The MongoDB Database Name
- `full_document` (String) Controls whether the full document should be included in the published change events. Full Document is not available by default in all types of change event. Possible values are updateLookup, whenAvailable, off. The default is off.
- `full_document_before_change` (String) Controls wheter the full document before the change should be included in the change event. Full Document before change is not available on all types of change event. Possible values are whenAvailable or off. The default is off.
- `pipeline` (String) A MongoDB pipeline to pass to the Change Stream API. This field allows you to control which types of change events are published, and which channel the change event should be published to. The pipeline must set the _ablyChannel field on the root of the change event. It must also be a valid JSON array of pipeline operations.
- `primary_site` (String) The primary site that the connector will run in. You should choose a site that is close to your database.
- `url` (String) The connection string of your MongoDB instance. (e.g. mongodb://user:pass@myhost.com)


2 changes: 1 addition & 1 deletion docs/resources/rule_azure_function.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ resource "ably_rule_azure_function" "rule0" {
}
request_mode = "batch"
target = {
azure_app_id = "coms",
azure_app_id = "demo",
function_name = "function0"
headers = [
{
Expand Down
19 changes: 19 additions & 0 deletions examples/playground/ingress_rule_mongodb.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
resource "ably_ingress_rule_mongodb" "rule0" {
app_id = ably_app.app0.id
status = "enabled"
target = {
url = "mongodb://${var.mongodb_user}:${var.mongodb_password}@${var.mongodb_host}:27017"
database = "coconut"
collection = "coconut"
pipeline = jsonencode([
{
"$set" = {
"_ablyChannel" = "myChannel"
}
}
])
full_document = "off"
full_document_before_change = "off"
primary_site = "us-east-1-A"
}
}
2 changes: 1 addition & 1 deletion examples/playground/rule_http_azure_function.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ resource "ably_rule_azure_function" "rule0" {
}
request_mode = "batch"
target = {
azure_app_id = "coms",
azure_app_id = "demo",
function_name = "function0"
headers = [
{
Expand Down
2 changes: 1 addition & 1 deletion examples/resources/rule_http_azure_function.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ resource "ably_rule_azure_function" "rule0" {
}
request_mode = "batch"
target = {
azure_app_id = "coms",
azure_app_id = "demo",
function_name = "function0"
headers = [
{
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/ably/terraform-provider-ably
go 1.19

require (
github.com/ably/ably-control-go v0.4.0
github.com/ably/ably-control-go v0.4.1-0.20241211161828-60786a2a414b
github.com/hashicorp/terraform-plugin-docs v0.13.0
github.com/hashicorp/terraform-plugin-framework v0.16.0
github.com/hashicorp/terraform-plugin-sdk/v2 v2.21.0
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ github.com/ably/ably-control-go v0.3.0 h1:m5Y2SHE69Mwg8iDASZxqmlHFSwpejN4s2TgZi3
github.com/ably/ably-control-go v0.3.0/go.mod h1:TP7gWAy+ga++gX6OZ0DtjwH8oVKKdiaIGQvZvxDKNdk=
github.com/ably/ably-control-go v0.4.0 h1:JouYcHKT2TvvAGPpEPQJcFo5p9k1KfLUr/k9bfy+tYI=
github.com/ably/ably-control-go v0.4.0/go.mod h1:TP7gWAy+ga++gX6OZ0DtjwH8oVKKdiaIGQvZvxDKNdk=
github.com/ably/ably-control-go v0.4.1-0.20241211161828-60786a2a414b h1:yHdqAi4zYDFIGmzv7WUPwA8JnLwaL5ExFys85Mf0Ih0=
github.com/ably/ably-control-go v0.4.1-0.20241211161828-60786a2a414b/go.mod h1:D5cHDJdYVHXdxfRwypsLaTySGE/bT3H0wlgxwBWCbxQ=
github.com/acomagu/bufpipe v1.0.3 h1:fxAGrHZTgQ9w5QqVItgzwj235/uYZYgbXitB+dLupOk=
github.com/acomagu/bufpipe v1.0.3/go.mod h1:mxdxdup/WdsKVreO5GpW4+M/1CE2sMG4jeGJ2sYmHc4=
github.com/agext/levenshtein v1.2.3 h1:YB2fHEn0UJagG8T1rrWknE3ZQzWM06O8AMAatNn7lmo=
Expand Down
Loading

0 comments on commit 84cda97

Please sign in to comment.