chaossearch_object_group Resource
Add or update an object group using Terraform
The chaossearch_object_group
resource creates an object group, or updates an existing object group for specific setting changes. An object group cannot be completely replaced, but the index retention setting can be changed for a group.
For more information about object groups and their fields, see Creating Object Groups or the Create a new object group endpoint documentation.
Example Usage for a JSON Object Group
resource "chaossearch_object_group" "create-object-group" {
bucket = "cloudtrail-object-group"
source = "my-datasets"
format {
type = "JSON"
array_flatten_depth = "1"
field_selection = jsonencode([{
"excludes":[
"Records.requestParameters",
"Records.responseElements",
"tags"
],
"type":"blacklist"
}])
vertical_selection = jsonencode([{
"excludes":[
"Records.requestParameters",
"Records.responseElements",
],
"type":"blacklist"
}])
}
filter {
field = "key"
prefix = "cloudtrail"
}
filter {
field = "key"
regex = "cloudtrail\\/AWSLogs\\/123457501321\\/CloudTrail\\/ap\\-northeast.*\\/201.*\\/.*\\/.*\\/123457501321_CloudTrail_ap\\-northeast.*\\.json\\.gz"
}
options {
compression = "GZIP"
col_types = jsonencode({
"Records.accountId": "String",
"Records.recipientAcountId": "String"
})
}
partition_by = "cloudtrail/AWSLogs/123456789021/CloudTrail/(\\S.+)/2022/12/\\.*"
}
Example Usage for a CSV Log File Live Index Object Group
resource "chaossearch_object_group" "create-object-group1" {
bucket = "cust-tf-objgrp"
source = "mys3-datasets"
live_events = "arn:aws:sqs:AWS-REGION:111111111111:MY-SQS-QUEUE-NAME"
format {
type = "CSV"
column_delimiter = ","
row_delimiter = "\n"
header_row = true
}
index_retention {
overall = -1
}
filter {
field = "key"
prefix = "ec"
}
filter {
field = "key"
regex = ".*"
}
filter {
field = "storageClass"
equals = "STANDARD"
}
options {
compression = "GZIP"
}
}
Argument Reference
Field | Required | Description | |
---|---|---|---|
| Yes | The name of the object group to create. The name must begin and end with a letter or number. Bucket names can contain only lowercase letters, numbers, and hyphens (-). | |
| No | These are fields used by ChaosSearch teams; do not use. | |
| Yes | The name of the cloud storage bucket where the objects for the group are stored | |
| No | A configuration block with file format details | |
| No | The type of the files in the group. Valid values are | |
| No | For CSV files, the column separator character | |
| No | For CSV files, a boolean value to indicate whether the files include a header row before the data | |
| No | The row separator character | |
| No | For LOG files, the regular expression pattern to use to parse the fields of the log file. ChaosSearch has several default regex patterns to parse common or previously seen log files. You can specify your own regex for your custom logs or new types of log files. | |
| No | For JSON files, a numeric value that specifies how deeply to flatten the properties contained in nested arrays at levels 1-10, all, or 0 to flatten no arrays. A value of -1 is unlimited flattening. Any arrays that are not flattened are indexed and stored as JSON strings, so their data is still captured within the Chaos Index content. | |
| No | A value of Up to provider v1.0.11, the default is false. Starting with provider v1.0.12, the default is true. Note that the Create Object Group UI strips the | |
| No | For JSON files, a boolean value that specifies whether to index the JSON file using horizontal flattening/expansion. The default ( | |
| No | For JSON files, a | |
| No | For JSON files, a | |
| No | For JSON files, a | |
| No | The SQS ARN to associate with the group when creating a Live Index group | |
| No | The amount of time in days to retain the indexed data for the object group. This value can be changed for an existing object group. | |
| Specify a value in days. A value of -1 is unlimited retention (old data will not be deleted). The default for a new group is 14 days. | ||
| Yes | A configuration block containing filtering rules to specify the bucket objects to include in the group based on object name prefixes or object pathname patterns. NOTE: The prefix, regex and equals filters must all be specified in their own filter block. | |
| Specifies what the filter applies to. Valid values are A value of | ||
| Specifies a min and max value for the filtering range. | ||
| Yes | Used with the | |
| No | Used with the | |
| No | Used with the | |
| No | A configuration block to specify advanced settings | |
| No | Specifies the compression used for the files indexed by the object group. Valid values are | |
| No | Overrides a column's data type. For example, you could set a number type used as an ID to be treated as a string. Example:\
| |
| No | Overrides a column's name. For example, you could change a column name to match a well-known name for your users. Example:\
| |
| No | Specify the fields to include (or exclude) as part of the object group index. By default, all object file columns are included as object group fields.
| |
| No | Specifies a regular expression to use as an isolation key for the object group. |
Updated 14 days ago