Skip to content

Commit

Permalink
SUMO-248048: updated the documentations for scheduled_views, data_for…
Browse files Browse the repository at this point in the history
…warding_rule and data_forwarding_destination and added example to correctly configure the data forwarding rule for a scheduled view
  • Loading branch information
namangoya committed Sep 21, 2024
1 parent 5dab9b8 commit 78a8578
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 10 deletions.
4 changes: 2 additions & 2 deletions website/docs/r/data_forwarding_destination.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ resource "sumologic_data_forwarding_destination" "example_data_forwarding_destin
access_key_id = "accessKeyId"
secret_access_key = "secretAccessKey"
role_arn = "arn:aws:iam::some-valid-arn"
encrypted = "false"
enabled = "true"
encrypted = false
enabled = true
}
```
## Argument reference
Expand Down
50 changes: 43 additions & 7 deletions website/docs/r/data_forwarding_rule.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,61 @@ description: |-
Provider to manage [Sumologic Data Forwarding Rule](https://help.sumologic.com/docs/manage/data-forwarding/amazon-s3-bucket/#forward-datato-s3)

## Example Usage

For Partitions
```hcl
resource "sumologic_partition" "test_partition" {
name = "testing_rule_partitions"
routing_expression = "_sourcecategory=abc/Terraform"
is_compliant = false
retention_period = 30
analytics_tier = "flex"
}
resource "sumologic_data_forwarding_rule" "example_data_forwarding_rule" {
index_id = "00000000024C6155"
destination_id = "00000000000732AA"
enabled = "true"
file_format = "test/{index}/{day}/{hour}/{minute}"
payload_schema = "builtInFields"
format = "json"
index_id = sumologic_partition.test_partition.id
destination_id = "00000000000732AA"
enabled = true
file_format = "test/{index}/{day}/{hour}/{minute}"
payload_schema = "builtInFields"
format = "json"
}
```
For Scheduled Views
```hcl
resource "sumologic_scheduled_view" "failed_connections" {
index_name = "failed_connections"
query = "_sourceCategory=fire | count"
start_time = "2024-09-01T00:00:00Z"
retention_period = 1
lifecycle {
prevent_destroy = true
ignore_changes = [index_id]
}
}
resource "sumologic_data_forwarding_rule" "test_rule_sv" {
index_id = sumologic_scheduled_view.failed_connections.index_id
destination_id = sumologic_data_forwarding_destination.test_destination.id
enabled = false
file_format = "test/{index}"
payload_schema = "raw"
format = "text"
}
```
## Argument reference

The following arguments are supported:

- `index_id` - (Required) The _id_ of the Partition or Scheduled View the rule applies to.
- `index_id` - (Required) The *id* of the Partition or *index_id* of the Scheduled View the rule applies to.
- `destination_id` - (Required) The data forwarding destination id.
- `enabled` - (Optional) True when the data forwarding rule is enabled. Will be treated as _false_ if left blank.
- `file_format` - (Optional) Specify the path prefix to a directory in the S3 bucket and how to format the file name.
- `payload_schema` - (Optional) Schema for the payload. Default value of the payload schema is _allFields_ for scheduled view, and _builtInFields_ for partition.
_raw_ payloadSchema should be used in conjunction with _text_ format and vice versa.
- `format` - (Optional) Format of the payload. Default format will be _csv_.
_text_ format should be used in conjunction with _raw_ payloadSchema and vice versa.

The following attributes are exported:

- `id` - The Index ID of the data_forwarding_rule
3 changes: 2 additions & 1 deletion website/docs/r/scheduled_view.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ QUERY
retention_period = 365
lifecycle {
prevent_destroy = true
ignore_changes = [index_id]
}
}
```
Expand All @@ -44,7 +45,7 @@ The following arguments are supported:
The following attributes are exported:

- `id` - The internal ID of the scheduled view.
- `index_id` - The Index ID of the scheduled view.
- `index_id` - The Index ID of the scheduled view. It never updates at any point of time during resource updates, therefore make sure to ignore this via `ignore_changes = [index_id]`.

## Import
Scheduled Views can can be imported using the id. The list of scheduled views and their ids can be obtained using the Sumologic [scheduled views api][2].
Expand Down

0 comments on commit 78a8578

Please sign in to comment.