-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5c7bbbb
commit 906e2bb
Showing
9 changed files
with
104 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
locals { | ||
id = coalesce(var.pattern_id, split("-*", var.pattern)[0]) | ||
} | ||
|
||
module "tenant" { | ||
source = "../../modules/dashboard/tenant" | ||
|
||
name = "test-tenant" | ||
} | ||
|
||
module "index_pattern" { | ||
source = "../../modules/dashboard/index-pattern" | ||
|
||
tenant_name = module.tenant.name | ||
pattern = "test-*" | ||
time_field_name = var.time_field_name | ||
} | ||
|
||
module "dashboard" { | ||
source = "../../modules/dashboard/object" | ||
|
||
tenant_name = module.tenant.name | ||
|
||
body = <<EOF | ||
[ | ||
{ | ||
"_id": "visualization:response-time-percentile", | ||
"_type": "doc", | ||
"_source": { | ||
"type": "visualization", | ||
"visualization": { | ||
"title": "Total response time percentiles", | ||
"visState": "{\"title\":\"Total response time percentiles\",\"type\":\"line\",\"params\":{\"addTooltip\":true,\"addLegend\":true,\"legendPosition\":\"right\",\"showCircles\":true,\"interpolate\":\"linear\",\"scale\":\"linear\",\"drawLinesBetweenPoints\":true,\"radiusRatio\":9,\"times\":[],\"addTimeMarker\":false,\"defaultYExtents\":false,\"setYExtents\":false},\"aggs\":[{\"id\":\"1\",\"enabled\":true,\"type\":\"percentiles\",\"schema\":\"metric\",\"params\":{\"field\":\"app.total_time\",\"percents\":[50,90,95]}},{\"id\":\"2\",\"enabled\":true,\"type\":\"date_histogram\",\"schema\":\"segment\",\"params\":{\"field\":\"@timestamp\",\"interval\":\"auto\",\"customInterval\":\"2h\",\"min_doc_count\":1,\"extended_bounds\":{}}},{\"id\":\"3\",\"enabled\":true,\"type\":\"terms\",\"schema\":\"group\",\"params\":{\"field\":\"system.syslog.program\",\"size\":5,\"order\":\"desc\",\"orderBy\":\"_term\"}}],\"listeners\":{}}", | ||
"uiStateJSON": "{}", | ||
"description": "", | ||
"version": 1 | ||
} | ||
} | ||
} | ||
] | ||
EOF | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
provider "opensearch" { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
variable "pattern" { | ||
description = "The index pattern" | ||
type = string | ||
default = "test-pattern-*" | ||
} | ||
|
||
variable "pattern_id" { | ||
description = "The ID of index pattern" | ||
type = string | ||
default = "test" | ||
} | ||
|
||
variable "time_field_name" { | ||
description = "Field name which has the timestamp" | ||
type = string | ||
default = "timestamp" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
terraform { | ||
required_version = ">= 1.4" | ||
|
||
required_providers { | ||
opensearch = { | ||
source = "opensearch-project/opensearch" | ||
version = "~> 2.3.0" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
resource "opensearch_dashboard_object" "this" { | ||
tenant_name = var.tenant_name | ||
body = jsonencode(var.body) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
output "id" { | ||
description = "The ID of the object" | ||
value = opensearch_dashboard_object.this.id | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
variable "tenant_name" { | ||
description = "The name of the tenant to which dashboard data associates. Empty string defaults to global tenant" | ||
type = string | ||
default = "" | ||
} | ||
|
||
variable "body" { | ||
description = "The dashboard document in JSON or HCL" | ||
type = any | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
terraform { | ||
required_version = ">= 1.4" | ||
|
||
required_providers { | ||
opensearch = { | ||
source = "opensearch-project/opensearch" | ||
version = ">= 2.0" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters