Creates a query in a dataset.
Queries can be used by triggers and boards, or be executed via the Query Data API.
variable "dataset" {
type = string
}
data "honeycombio_query_specification" "test_query" {
calculation {
op = "AVG"
column = "duration_ms"
}
filter {
column = "duration_ms"
op = ">"
value = "200"
}
}
resource "honeycombio_query" "test_query" {
dataset = var.dataset
query_json = data.honeycombio_query_specification.test_query.json
}
The following arguments are supported:
dataset
- (Required) The dataset this query is added to. Use __all__
for Environment-wide queries.query_json
- (Required) A JSON object describing the query according to the Query Specification. While the JSON can be constructed manually, it is easiest to use the honeycombio_query_specification
data source.In addition to all arguments above, the following attributes are exported:
id
- ID of the query. Useful for adding it to a board and/or creating a query annotation.Querys can be imported using a combination of the dataset name and their ID, e.g.
$ terraform import honeycombio_query.my_query my-dataset/bj8BwOa1uRz